sad
How have you connected the LED? Did you connect the LED to GPIO P1.02 (pin # 39 on the module)? Note that the pin numbers used in the application is referring to the GPIO number (PORT_NUMBER*32 + PIN_NUMBER).
Which SDK version are you using? Have you tried both setting and clearing the GPIO? Have you tried setting the GPIO manually without the GPIO HAL functions?
NRF_P1->PIN_CNF[2] = (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos) | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) | (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); NRF_P1->OUTSET = (1UL << 2); // Set GPIO P1.02 high NRF_P1->OUTCLR = (1UL << 2); // Set GPIO P1.02 low
I just tried, incl. on zero port on several pins.
Unfortunately, the result is zero. Maybe you need some PPI settings or disable standard UART or something else.
During the tests - additionally did not include anything. If you enable SPI 0 and output MOSI or SCK on the same P 1.02 - everything works, I see the signal visually (on the LED) and on the oscilloscope - the signal is clear.
I tested both codes on a nRF52840 DK. Both work as expected. Please make sure the pins are not configured for anything else when using as GPIO (SPI, etc.). Do you see any pin change on your scope?
#define BASE 0x50000000 ptr = (int*) (BASE + 0x714); *ptr= 0x00000001; while (1) { ptr = (int*)(BASE + 0x508); *ptr=0x20; nrf_delay_ms(1000); ptr = (int*)(BASE + 0x50C); *ptr=0x20; }
This code works as expected (for port 0 pin 5). But if I try to register BASE as 0x50000300 and change the pin of the first port accordingly (Listing 2), nothing happens.
#define BASE 0x50000300 ptr = (int*) (BASE + 0x708); *ptr= 0x00000001; while (1) { ptr = (int*)(BASE + 0x508); *ptr=0x4; nrf_delay_ms(1000); ptr = (int*)(BASE + 0x50C); *ptr=0x4; }
Mystic. I rerun Listing 2 from a colleague - everything works
Mystic. I rerun Listing 2 from a colleague - everything works
Could there be something wrong with your module, or did you test it on the same module?
I tested on the same module. Firmware coincided absolutely. The only difference is that the colleague used IAR om, and I KEIL
Sounds like there is something wrong with your project settings then. If you post your project, I can take a look at it.
It no longer makes sense, changed the environment to IAR and everything works as it should (not only the GPIO, but also the entire project including SPI).