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

NRF51422 SPI slave BLE send

Hello all,

So.... i'm quite green to the Nordic and Bluetooth protocol. i want to program NRF51422. what i have now it the Nordic test board and a spi-canbus print. this all is going to be a pcb for a project. but now is the problem that i can't get around the BLE protocol. i tried combining the SPI and UART program. i watched the youtube tutorial. I've programmed some C chips etc but i'm drowning in all the information. can some one help me with information.

thank you all!

  • I'm afraid there is no shortcut here beside good tutorials by Nordic and other people here on top of the page, youtube, GitHub, nRF5 SDK examples. This is not five-minute or even five-day exercise, from my experience to write reasonably optimized production FW on nRF5x it's not even 5 weeks but rather 5 months. Indeed most of that time is embedded programming in C, ARM Cortex-M specialties and BLE architecture (which is crucial for understanding of stack, API and whole SDK which is key for good nRF5x firmware). So if you have some experience in any of these fields it can be shorter. But I wouldn't expect you will write anything great this week;)

    On the positive note, SPI behaves very much the same as UART in terms of data transport (can be full-duplex, no real lengths restrictions, all driven by higher-level app etc.) so if you have some SPI communication from/to nRF5x chip and you want to just relay it over BLE you can use Nordic BLE UART Service (aka NUS) basically without any modification. Just complete things which are not in examples (which is application logic "how the data appear in the nRF5x chip" and then fragmentation on top of NUS GATT data - because I assume you want to have larger streams then 20 bytes and you don't want to keep it completely unstructured/unformatted and asynchronous, but maybe you can). So using ble_uart example and then obviously SPI master or slave one from HW peripheral examples should give you all building blocks.

  • thanks for the reply! so what i want to do is: receive from SPI-CAN module. then send it to my mobile via Bluetooth. Now i have the ble_app_uart i've added the main code from spi_pca. and i have some sort of comminucation but not yet the things that i want. could you help me some more?

  • I'm afraid I cannot;) My assumption is that any average Sw engineer with C knowledge and understanding of embedded programming will complete usual tasks on nRF5x after few days or weeks of getting hands-on experience. If you have very specific problem in terms of "I do this and this in the code and while it works in that example it fails in mine" then feel free to submit new question and you will get at least basic feedback from Nordic support team or someone else on the forum (well structured and reasonable questions are typically answered within 24 hours). If you don't feel comfortable with completing whole task (which is also valid option for many people coming here) then you are looking for programmer not advice. Then finding and hiring some consultant might be a good idea.

Related