This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52810 SPI PSEL pins wont set & infinite loop

Currently blocked by this issue.

// CFG_PIN_GLUE_DAT = 5

// CFG_PIN_GLUE_CLK = 6

NRF_GPIO->PIN_CNF[CFG_PIN_GLUE_DAT] = pinDisconnectInputBuffer | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
NRF_GPIO->PIN_CNF[CFG_PIN_GLUE_CLK] = (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);

NRF_SPI0->PSEL.SCK = CFG_PIN_GLUE_CLK;
NRF_SPI0->PSEL.MOSI = CFG_PIN_GLUE_DAT;
NRF_SPI0->PSEL.MISO = SPI_PSEL_MOSI_CONNECT_Disconnected << SPI_PSEL_MOSI_CONNECT_Pos; // unused

// WARN - pins appear not be set, see screenshot! Huh?!?

NRF_SPIM0->ENABLE = SPIM_ENABLE_ENABLE_Enabled << SPIM_ENABLE_ENABLE_Pos;

NRF_SPI0->TXD = 15;

while (!NRF_SPI0->EVENTS_READY) {}  // STUCK HERE. Does writing to TXD auto trigger a send?
NRF_SPI0->EVENTS_READY = 0;

Parents
  • // WARN - pins appear not be set, see screenshot! Huh?!?

    Which debugger are you using? is the debugger halted when you took the snapshot of these registers? Is the program compiled for debugging? This looks more of the IDE issue than the issue in the code. 

  • Segger, and yes to the rest. Actually you can see in the same screenshot the "frequency" is read correctly.

    I've followed the manual/spec to the letter. For the PSEL pins maybe that is still the debugger reading from the wrong memory location. If not, it could be the reason why TX doesn't work (according to the lack of EVENTS_READY flag).

    All other peripherals are disabled and SoftDevice not initialized (although I don't think anything touches SPI anyway but worth considering the main crystal hasn't been halted).

Reply
  • Segger, and yes to the rest. Actually you can see in the same screenshot the "frequency" is read correctly.

    I've followed the manual/spec to the letter. For the PSEL pins maybe that is still the debugger reading from the wrong memory location. If not, it could be the reason why TX doesn't work (according to the lack of EVENTS_READY flag).

    All other peripherals are disabled and SoftDevice not initialized (although I don't think anything touches SPI anyway but worth considering the main crystal hasn't been halted).

Children
Related