LPS Node sniffer UART output

All discussions related to the Loco Positioning system
Post Reply
shuraux
Beginner
Posts: 7
Joined: Tue Apr 21, 2020 3:48 pm

LPS Node sniffer UART output

Post by shuraux »

Hello !

I am currently working on a project with some LPS Nodes. Our setup consists in (currently) 6 nodes functioning as TDoA3 anchors. This is working fine with a Crazyflie and a roadrunner, but we would like to use a node as a moving tag.

For that, we have configured two of them as sniffers. Our goal is to connect it to a RPI, in order to apply Kalman filter to received sniffed data.

Data retrieval is working fine from Node to RPI over Micro USB, using Python scripts included in the /lps-node-firmware/tools/sniffer directory (https://github.com/bitcraze/lps-node-firmware); it just needs some YAML installs to work fine (I've installed some libs as mentioned here : https://stackoverflow.com/questions/142 ... for-python).
So, the node is sniffer mode is working fine and we can get data over the Micro-USB port.

What we would like to do though, is to use one of the UART peripheral of the node, instead of the Micro-USB port.

As seen in the schematic (https://wiki.bitcraze.io/_media/project ... e_reve.pdf), there is two UART ports available on the Node. The one on P3 connector (FTDI), which is the USART1 of the MCU, and the EXT, which is the USART3 of the MCU.

I've read here (viewtopic.php?f=16&t=3935&p=17936&hilit ... ode#p17986) that the FTDI UART can me used by uncomenting a line in the Makefile, but I don't really know what else has to be modified in order to have the sniffed data sent over it, or even if it is possible. By using a UART to USB converter, I can create a connection between the UART and my computer, but the Node doesn't seem to send anything.

One thing that bothers me is that the .dfu file is not updated when I do a "make" with the updated Makefile., but since I'm new to this, this may be not a problem. (I use the lpstools to update the Node's firmware).

I guess maybe using the USART3 peripheral is a better idea, since I guess its availability on the PCB is here for this kind of purpose. I know a little bit about how the HAL of STM32 works, since I have a STM32F072 Nucleo board as well. I already made a simple program with STM32CubeIDE to use UART on it. But I still feel a bit lost inside the actual node firmware.

Anyway, sorry for the quite long post, and I hope someone can give me some hints on how to actually modify the firmware to use this USART3.

Cheers,

Sylvain
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: LPS Node sniffer UART output

Post by kristoffer »

Hi!

I looked at the code and in this section https://github.com/bitcraze/lps-node-fi ... #L197-L216 you can see that the input/out will be redirected to the UART instead of USB. I don't have a system to test on, but I think it will work. Try to clean the project before building to make sure all code is rebuilt.

Code: Select all

make clean
make
It is probably easier to use UART1, but if you want to try UART3 instead, it looks like it is almost already set up in the firmware, just not initialized. It is used in the production tests (https://github.com/bitcraze/lps-node-fi ... ion_test.c) so most of it should be there.
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: LPS Node sniffer UART output

Post by kristoffer »

By the way, don't worry about long questions. It is must easier to provide a good answer if the question is clear :-)
shuraux
Beginner
Posts: 7
Joined: Tue Apr 21, 2020 3:48 pm

Re: LPS Node sniffer UART output

Post by shuraux »

Thanks for the quick answer !

I had indeed saw the part of code you highlighted, and thought it was probably how to switch between the USB UART to the FTDI UART. I will try to do a clean before make and see what's happening.
shuraux
Beginner
Posts: 7
Joined: Tue Apr 21, 2020 3:48 pm

Re: LPS Node sniffer UART output

Post by shuraux »

Update : it worked !

I did a make clean before make, and it indeed recompile everything, as well as creating an updated .dfu file. It now sends data over the FTDI UART.
Note to others : default baudrate is 115200, you need to update value in this file : https://github.com/bitcraze/lps-node-fi ... _binary.py in order to use the script.

Thank you for the tip, and have a nice day !
Post Reply