Get GPS sentence through UART (Zephyr)

Hi,

I would like to know if there are sample programs for getting GPS sentences through UART using Zephyr. I am using Fanstel (BT840X) board. I would also like to know the configurations that needs to be set so that I can get the GPS sentences through UART. 

Thank you!

  • Hello Oli,

    first of all, my apologies for the late reply! I was out of office unplanned during last week.

    snowstorm said:
    hence the reason I was asking if there are other Zephyr Sensor Sample Programs that interacts or uses UART. An example zephyr program that interacts with the uart would be great because it can kickstart projects that needs the uart protocol and we can modify and understand what configurations we need to include in the proj.conf, dts file, etc.

    May I ask what kind of sensor you will use in your project? Many sensors are using I2C/SPI as interface for communication, so Zephyr does not offer that many samples demonstrating the usage for UART with the Sensor API.

    However, there is one sample which uses UART, the MH-19B: CO2 Sensor Sample. I haven’t tried this myself, but maybe it is possible to add your sensor to the desired UART peripheral of your device, as shown in this overlay file.

    Otherwise, I refer to the UART API documentation, which should be quite straight forward to use.

    Regards,

    Markus

  • Hi, 

    Thanks for the reply. I will be using an ultrasonic sensor. 

  • Hi, 

    I have managed to make the Zephyr UART work by using the Polling API. But the other problem that I am getting is when the character that is read is "," the uart_poll_in returns -1 and does not get the succeeding data. Have you encountered this problem? 

  • Hello Oli,

    snowstorm said:
    But the other problem that I am getting is when the character that is read is "," the uart_poll_in returns -1 and does not get the succeeding data. Have you encountered this problem? 

    return value -1 means that the UART input buffer was empty. How do you know that it is character “,” and does it work with other ones?

    Regards,

    Markus

  • Hi Markus, 

    I just need to follow up on what you said that Zephyr does not support the Fanstel? Maybe I missed something. 

    But Zephyr does not support the Fanstel BT840X and for receiving GPS data, you need an external device like the nRF9160 anyway.

    For the poll function, I think the program that I have used does not clear the buffer that is why the "," is still read even though the return value is -1. 

    I have another question though, can the polling function recognize a space? or when it sees a blank space it terminates the polling? 

    Thanks, 

    Oli

Related