I am trying to build a simply first blinky
on a nrf51822 china clone (YJ-14015), as part of building a redox wireless and debugging why the BLE communication does not work.
As SDK I use nrf5_SDK_11
as the keyboards custom firmware is based on it.
Now I tried a very minimal example blinky with main.c
#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "nrf_gpio.h"
#define LED_PIN_1 1 // LED connected to pin 1
/* --> from nrf5_SDK_11/components/drivers_nrf/hal/nrf_gpio.h
__STATIC_INLINE void nrf_gpio_pin_set(uint32_t pin_number)
{
NRF_GPIO->OUTSET = (1UL << pin_number);
}
__STATIC_INLINE void nrf_gpio_pin_clear(uint32_t pin_number)
{
NRF_GPIO->OUTCLR = (1UL << pin_number);
}
*/
int main(void)
{
// Make LED pin an output pin
nrf_gpio_cfg_output(LED_PIN_1);
nrf_gpio_pin_set(LED_PIN_1);
// Toggle LEDs.
while (true)
{
// Down
NRF_GPIO->OUTCLR = (NRF_GPIO->OUT & (1UL << LED_PIN_1));
// nrf_gpio_pin_clear(LED_PIN_1);
nrf_delay_ms(1000);
// Up
NRF_GPIO->OUTSET= (NRF_GPIO->OUT | (1UL << LED_PIN_1));
// nrf_gpio_pin_set(LED_PIN_1);
nrf_delay_ms(1000);
}
}
My expectation would have been that I can see the voltage flip every second from high to low to high etc on PIN 01
... Unfortunately I only get a 1.55 V
vs ground if I attach it to my multi meter, but the voltage just stays constant and nothing changes. Anything I did wrong with this loop?
For flashing I use a ST-LinkV2 clone + the docker containers for openocd and the toolchain of the redox wireless project, which basically uses telnet over openocd. After adjusting for the right paths, flashing seems successful and as mentioned above, PIN 01
can be set to 1.55V
, so I assume there is no problem with the flashing itself.