Transitioning from Arduino to nRF52840 for IoT Application Development

Hello Nordic Community,

I am currently working on a project that involves transitioning from a working Arduino application to a finished IoT application targeting Garmin-style devices to display acceleration and velocity data. I have some background in both software and hardware development and have purchased the Nordic nRF52840 Evaluation Board to facilitate this transition.

I would like to seek your advice on the recommended steps to make this transition smooth and efficient. Specifically, I am interested in:

  1. SPI/I2C Communication: Any guidance on setting up SPI communication with accelerometers and other sensors.

  2. Data Handling: Best practices for reading and processing acceleration and velocity data from sensors.

  3. Bluetooth Communication: How to establish Bluetooth Low Energy (BLE) communication with Garmin-style devices, including any example code or libraries.

  4. Power Management: Tips on optimizing power consumption, especially for battery-operated applications.

  5. Development Tools: Recommended tools and IDEs for development with the nRF52840, along with any libraries that may help streamline the process.

  6. Testing and Validation: Suggestions for testing my application, particularly for ensuring reliable communication and accurate data readings.

Any insights or resources you could share would be greatly appreciated, as I aim to create a robust and efficient application.

Thank you in advance for your help!

AA

  • 1: Yes. That is the common way to do it, I believe. At least the simpler way. You will have a few connectors that you can use for programming. Basically, using an external programmer (you can use the programmer on the DK to program external devices). What you need is that the external device is powered, and you need to connect SWDIO and SWDCLK, as well as GND and VDD. 

    2: I am no pcb layout expert. Follow the reference circuitry for the configuration you want to use. You can submit your layout for review, or ask genereic questions about it, but do so in another ticket, and a HW engineer will have a look at it.

    3: You can't flash through USB (the USB peripheral on the nRF). You can perform DFU(device firmware upgrade) via USB if you'd like, but then you will need to flash a USB bootloader using the programming pins. You can also perform DFU using BLE, but likewise, you will need to program a bootloader first. 

    4: That is a good question. For simple applications, it may be enough with the internal flash, but you need flash space for: The application, including the Bluetooth controller (all part of your application .hex file). If you intend to do DFU/FOTA (Device Firmware Upgrade / Firmware Over The Air (upgrade)), you will need space for the bootloader itself, in addition to 2x your application. This means that the application can be no more than ((Total flash - Size of bootloader) / 2), because you need to fit the new and old application at once in addition to the bootloader. 

    5: You can use the DK and one of the DEBUG OUT ports on the DK. Both the P19 and P20 on the DK can be used as debug out ports.

    6: You can provide power from the DK, or externally. E.g. on the DK's P20, if you connect VTG and GND Detect to VDD and GND, respectively, it will use the P20 as the debug out target, instead of the onboard nRF52840. But the VTG and GND Detect themselves doesn't provide GND and VDD, but you can use the VDD nRF on P20, or any of the normal VDD pins on the DK. Or you can power it via e.g. a USB connector on the custom board, or a battery. Up to you. 

    NB: The VTG and GND detect are named a bit differently on different DK versions, but show me a picture of your DK's P20, and I can point out which ones to use. 

    7: Correct, but it depends on the VDD level on the custom board. They are not rated to work with debug out on VDD lower than 3.0V, but in most cases, it works. So what is VDD when the device is connected to power? And what if you power it from the DK's VDD? If you do that, then it should work. Please see this description. I know it is for the nRF5340DK, but it has the same debugger. And the nRF52840 DK description doesn't have that figure, which is why I sent you the one for the nRF53DK. 

    8: I am not sure. Please open a new ticket with this question (since it is more HW related). Someone fitting will have a look at it. 

    9: I believe so, but ask in the HW ticket.

    10: HW Ticket.

    11: Looks good. Please refer to: https://docs.nordicsemi.com/bundle/ps_nrf52840/page/pin.html

    Note that some pins are AIN pins, which is OK. But there is a limited set of AIN (Analogue input) pins, so if you would need one, those are the one you can use for it. But if you don't need AIN pins, then you are good. (Perhaps you want to use one for battery measurement?)

    Also note that some pins are marked with QSPI. These are intended for QSPI. You can use them for other things, but if you need QSPI for e.g. external flash, then you would want to reserve them for that. Also note that the QSPI pins are not routed out to the pin header on the DK, without shorting some solder bridges and cutting some other on the DK. These are described on the back of the DK. 

    12: Internal pullups are configureable in SW. 

    frusciante89 said:
    I assume the nRF5340 is used as a middle-man in the DK board?

    The nRF53 on the nRF52840 DK is actually the debugger for the nRF52840. 

    frusciante89 said:
    I've just noticed there's another USB port, named USB nRF52840 - should I use this instead?

    This USB port is used if your application is using the nRF52840's USB peripheral, e.g. if you are developing a USB stick, a usb dongle for a mouse/keyboard peripheral or any other application that uses the USB peripheral present on the nRF52840. 

    Ok, so a lot of information, but unfortunately I couldn't answer everything. I could cooperate with one of my HW specific colleagues, but I think it is faster to split the questions into two tickets. One where we keep the software questions, and one to handle the HW questions. 

    So gather up the HW questions in another ticket. It is possible to use the USB peripheral on the nRF for power, but I don't think you can use it directly to charge your battery. I think you need to use a Power Management IC (PMIC) for that, such as the nPM1300. But ask about it in the HW ticket that you can post here on DevZone.

    Best regards,

    Edvin

  • Thanks a lot Edvin! Slight smile

    This is extremely useful!

    I've opened another ticket for the HW parts:  (Missing Forum Thread) 
    Hopefully will get an answer soon

    Best,
    AA

Related