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

How to get Sensor value over UART from External MCU (Arduino) to nRF9160?

Hello There,

Basically I just want to get Sensor data like (Temp Sensor) who already connect to Arduino and I get it ,
So I just want that data to nRF9160 over UART in nRF9160 DK and Send it to the Server.

How can i do this, IF the suggestion is Connect with an External MCU so how to Connect with Arduino Do I need to Load the code or Something in Arduino.

Thanks

Jaydip

Parents Reply Children
  • Hi Simon,

    Thank you for the response,

    I am able to communicate with nRF9160dk to Arduino.

    but the question is can't find the receiver buffer how can I receive my Arduino sensor data in main.c file can you pls give me some hints or some points.

    and above example can work with nRF52840 mcu instead of Arduino if yes then what should i write code for nRF52840mcu.

    Thanks & Regards

    Jaydip Kavaiya

  • jaydip1305 said:
    and above example can work with nRF52840 mcu instead of Arduino if yes then what should i write code for nRF52840mcu.

    The Arduino code is not compatible with the nRF52840. However, the lpuart sample i linked to should work with the nRF52840. However, you have to modify the nrf52840 overlay file like I did for the nRF9160

    https://github.com/nrfconnect/sdk-nrf/compare/v1.6.0...simon-iversen:lpuart_using_normal_uart

    jaydip1305 said:
    but the question is can't find the receiver buffer how can I receive my Arduino sensor data in main.c file can you pls give me some hints or some points.

    As you can see at this line we get the length of the received data using evt->data.tx.len. You can access a pointer that points to the receive buffer at  evt->data.tx.buf.

    By the way:

    The code I linked you to is based on the LPUART sample but it is modified to use the normal UART driver instead (such that uart.h-->uart_nrfx_uarte.c is used instead of uart.h-->uart_nrf_sw_lpuart.c --> uart_nrfx_uarte.c). This was because this makes it possible to disable flow control and I wanted to provide you with a simple sample to start with.

    Best regards,

    Simon 

Related