SPI slave not working when BLE part is added

I'm using an nRF52832 with SDK v15.3.0 configured as an SPI slave in mode 0, with a master clock speed of 1.25 Mbps. My SPI pin assignments are:


- CS -> P0.06
- MISO -> P0.05
- MOSI -> P0.08
- SCK -> P0.07

I modified the example from peripheral/spis with logs enabled, and it worked fine. However, when I copied the settings from sdk_config to my main application, which also includes Bluetooth functionality, it stopped working. I found no signal on the clock lines.

After erasing and flashing the SPI slave example, it worked again. When I commented out the Bluetooth code and disabled logs, the SPI slave worked, but transactions were missing. I didn’t test it thoroughly after these changes.

Why does the application fail when Bluetooth is active, and how can I fix it?

Parents
  • Hi,

    Have you checked if there may be any conflicting pin assignments in your Bluetooth application? The SPI pinout you have selected is the same as the default pinout used for the UART Do you have logging over UART enabled? 

    Best regards,

    Vidar

  • NRF_LOG_BACKEND_UART_ENABLED, and  BLE_NUS_ENABLED are set to zero.

    NRFX_UARTE_ENABLED and NRFX_UART_ENABLED are enabled. Also in the simple spi slave example they are enabled and disabling it has no effect on my ouput.

  • Sorry for the delay.

    enabling the constant latency power mode

    Yes, I have enabled it in both the simple peripheral and ble application.

    Attached is the file on which I am working on.

    spis_peripheral.zip

    ble_app_spis.zip

  • The project you provided does not include BLE.

  • My Bad. I have edited and attached it in the same reply.

    I have used ble_app_template example and to simulate events, I am trying to send commands after each BLE connect and disconnect.

    I have used queue in my main app to send the commands but here I am directly polling and sending them.

  • Thanks for sharing the project. Unfortunately, I have not been able to spot any errors. Please try to log the SPIS events in your code to see which events are triggered:

    it stopped working. I found no signal on the clock lines.

    I'm not sure I understand this. The clock signal is generated by the SPI master.

  • Thank you for the quick reply.

    I connected and disconnected the peripheral(with some pause as I have not implemented a queue in the shared code) and following are the logs generated.

    What I am observing is I am able to receive the connect and disconnect event every alternate time. If I miss connect event, I also miss the disconnect event on the master. Overtime both the signals get missed. This was not happening with the code where ble is not present.

    Following are the logs.

    00> <info> app: Template example started.
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS received 1 bytes
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS received 1 bytes
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS received 1 bytes
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0

    I'm not sure I understand this. The clock signal is generated by the SPI master.

    There could be an issue from my end. It is a custom board and I don't have a test pad for debugging, the wore soldered on track could be loose. I have removed it now.

Reply
  • Thank you for the quick reply.

    I connected and disconnected the peripheral(with some pause as I have not implemented a queue in the shared code) and following are the logs generated.

    What I am observing is I am able to receive the connect and disconnect event every alternate time. If I miss connect event, I also miss the disconnect event on the master. Overtime both the signals get missed. This was not happening with the code where ble is not present.

    Following are the logs.

    00> <info> app: Template example started.
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS received 1 bytes
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS received 1 bytes
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS received 1 bytes
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Connected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: Fast advertising.
    00> 
    00> <info> app: Disconnected.
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 0
    00> 
    00> <info> app: SPIS event: 1
    00> 
    00> <info> app: SPIS event: 0

    I'm not sure I understand this. The clock signal is generated by the SPI master.

    There could be an issue from my end. It is a custom board and I don't have a test pad for debugging, the wore soldered on track could be loose. I have removed it now.

Children
Related