This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF51822 SPI isr not working

Hello,

I'm working on a custom board based on nRF51822, with keil 5.12 and a segger jlink. I'm trying to setup an SPI connection with the an accelerometer, starting from the spi_master_example of the 6.1 SDK. I simply adapted the SPI pinmap with my pin configuration and configured the spi_config with the correct values for the accelerometer.

By now, after the first send/receive call, the peripheral is always in busy state and SPI0_TWI0_IRQHandler is never called. Looking with the oscilloscope to the signals I found that, after the init of the peripheral, SCK and MISO are always high, while MOSI is always low.

Anyone has an idea why it is not working properly or what I should check to have more details about what is wrong?

Thanks in advance for any help!

UPDATE: in the board i tried to change the pin on which I drive the CLK and MOSI and all works fine. The question is CLK was on pin P0.02, while MOSI was on pin P0.01: can those pins be used to drive the SPI? In the Nordic reference manual the only requirements is that the pin have to be configured as GPIO and in the product specification those pins present also GPIO capabilities. Any idea on what could be (leaving out the accelerometer)?

  • Yes, you can use P0.1 and P0.2 for the MOSI and CLK, so if it works on all other pins, you should make sure you haven't assigned those pins to some other peripheral. Other than that it is hard to say what is wrong. You said you "configured the spi_config with the correct values for the accelerometer". What did you change? Since you are using a custom board, it is also a possibility that there is an hardware issue of course, but that is not easy to figure out without seeing the layout.

Related