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

nrf51822 spi slave problems

Hi,

I'm trying to communicate between a stm32f4 (spi master) and a nrf51822 (spi slave). I have configured the MISO, MOSI, CS and SCLK of the nrf. I use the spi_slave_example for testing the communication.

First question is : why the MISO pin is configured as input?

The stm32f4 can well communicate with my other sensors through spi, but with the nrf nothing append. The callback method is never call. I don't understand why.

I don't really understand what is the goal of the spi_slave_buffers_set method.

Is there a special address or sequence to send to the nrf for start slave communication?

Thank you already for your help

  • When any peripheral that needs GPIOs to function properly is started, this specific peripheral overrides the GPIO-configuration to suit its needs. In this case MISO becomes an output.

    For each completed transaction, the semaphore is released. You'll then need to call the spi_slave_buffers_set again to acquire it again.

    There should not be a special sequence, as long as everything is configured correctly (SPI mode/bit order) and it's physically connected correctly.

    Do you get any interrupts at all? Do you receive 0xAA/0x55 data on the ST-side?

  • Thank's for explanation, it's more clear.

    No, I never have an interrupt in the SPI_TWI_IRQHandler or spi_event_handler. It's very strange and I have no more idea to try. I test the communication between my cortex M4 and the nrf with nrf has master, it's work perfectly. But in the other side (nrf slave), nothing happend. I don't receive 0xAA or 0x55. I checke the timing specified in the datasheet, i work with a spi clock at 1.3 MHz and others timing seems ok. Any idea for solving my problem?

  • Hi Dear,

    Did you get your problem solved ? I m trying similar sort of thing. Only difference is my SPI master is MSP430 not ST. And i still dont get why MISO pin is configured as input in nRF. I'm using spi_slave_example application.

    Brajesh

Related