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 Reply
  • Nothing like asking an obvious question, but just in case ..

    .. then I initialize the SPI instance and pins etc. I am NOT trying to communicate with the SPI just yet

    SPI will have no clock activity on SCK (pin 7) just by initialising the SPI driver, other than the pin being pushed to the '0' or '1' level as specified by the SPI Mode. the clock is active only for 16 cycles (for example) if the SPI transfer packet is 2 bytes, after which the pin will go quiet. If there is no SPI communication attempted, there will be no activity on pin 7 (SCK).

    If I misunderstood your sequence then just ignore this :-)

Children
  • No that might not be the problem. 

    Even when I run the data call /spi transfer function once every time in the main loop, the clock for the SPI doesn't work.. 
    My SPI works fine in the SPI example project. The same code doesn't transfer data properply when it's added in a ble_template or a ble_uart_example.. 

    I tried removing all the BLE functions from the BLE _UART example project and then running just the SPI code but that doesn't work either. 

Related