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

SPI in BLE_UART example, clock not working

Hi, 

I am trying to read data via an ADC through SPI and send it via Bluetooth to the NRF mobile app. I checked that both the original BLE_UART example and the SPI master code work properly on my custom board when flashed separately, My custom pcb is nrf52382 based, I used SDK 15.2 in Embedded Studio to program it. 

When I include the SPI code in the ble_uart example, the chip advertises, and I check that the nus_data_handler is called as well. But SPI part does not work. My chip select is low, MOSI is low, so I see that gpio pin initialization works. But I do not get a proper clock signal from nrf to ADC. This clock pin is pin 7. I don't know why the BLE would interrupt with spi clock functionality. Pin 7 is not being used anywhere else in the code I checked the sdk_config,h file. 


More details on code: my code is not complicated. I was debugging my problem so I am using most of the functions in the SDK without modification, I remove the uart and NRF_LOG functions from the ble_uart example so that my pin 6 can work (this is my chip select pin for ADC). Then I initialize the SPI instance and pins etc. I am NOT trying to communicate with the SPI just yet, for starters I was  trying to simply initialize it and see if the clock is good before I actually transferred data. 

Any ideas or suggestions that would help debug the problem are appreciated. Thanks!  

I know there is another ticket by the same title, I started that but didn't get help, and the issue persists. 

Parents
  • Hi,

    Can you for testing try any of the pins that is not by default configured and used as UART (5, 6, 7, 8) by the nRF5 SDK? 

    Then you can isolate if the problem is related to overlapping configuration with UART somehow and/or a completely different issue.

    Best regards,
    Kenneth

  •  Thank you for your response. 

    I tried toggling pin # 7 as a simple GPIO in my edited ble_uart + spi code and it toggles just fine. 
    I tried using pin 11 instead of 7 for SPI_CLK but I still cannot see any clock signal on it. The same pin (11) gives a proper clock on the original SPI master example through so I'm sure it's not the pin that's the issue.

    Should I share my sdk_config.h file with you? In the ble_uart example sdk_config.h file I added the spi pin definitions, included the spi header, and then went on to enable spi master, nrfx_spi, and the timers. Not sure I need to do something else as well to use spi in this project..

    I also wanted to mention my interrupt priority is 6 for the SPI in the ble_uart ex and that I did make sure my timers are enabled, if that matters in any way? 

Reply
  •  Thank you for your response. 

    I tried toggling pin # 7 as a simple GPIO in my edited ble_uart + spi code and it toggles just fine. 
    I tried using pin 11 instead of 7 for SPI_CLK but I still cannot see any clock signal on it. The same pin (11) gives a proper clock on the original SPI master example through so I'm sure it's not the pin that's the issue.

    Should I share my sdk_config.h file with you? In the ble_uart example sdk_config.h file I added the spi pin definitions, included the spi header, and then went on to enable spi master, nrfx_spi, and the timers. Not sure I need to do something else as well to use spi in this project..

    I also wanted to mention my interrupt priority is 6 for the SPI in the ble_uart ex and that I did make sure my timers are enabled, if that matters in any way? 

Children
Related