Minimal Messaging System for STM32

Post here to get support
Post Reply
Slaxx
Member
Posts: 86
Joined: Tue Mar 03, 2015 11:19 am
Location: Switzerland

Minimal Messaging System for STM32

Post by Slaxx »

Hello
I'm still trying to run NuttX on the STM32. Since I don't want to change the Firmware on the NRF51822, I try to implement a minimal system on the STM32 such that I can send stuff using the Python or C library and then use it on the STM32. I realized that I don't get into the main loop but stuck at the connection process. Probably because the STM32 is not returning anything. So my question is: What is the minimal functionality that the STM32 must provide in order that it receives the packages?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Minimal Messaging System for STM32

Post by tobias »

The NRF51 will automatically start sending power managment messages (vbat) over the uart. You need to be able to receive those messages. It is done in the syslink uart dirver and in the handler. The protocol is documented here. One note is that there is also a flow control implemented because the NRF51 can't handle fast uart communication all the time and uses this signal to tell the STM32 it is busy. The STM32 then pauses the transmission until the NRF51 is ready again.
Slaxx
Member
Posts: 86
Joined: Tue Mar 03, 2015 11:19 am
Location: Switzerland

Re: Minimal Messaging System for STM32

Post by Slaxx »

OK thank you. The syslink stuff seems to work. What I have problem with is the Radiolink apparently.
If I change the channel and datarate from standard 0/0/2M to 0/80/250k with Syslink Commands, the Crazyflie client starts finding many different Crazyflies (see picture). Actually if I only change the Channel everything seems fine. But as soon as I change the datarate to 250k I start finding many even with channel 0.

Image

Edit: I put my question on flow control in a separate thread, since I think this might be interesting for other developers as well and makes it easier to find: viewtopic.php?f=6&t=1641
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Minimal Messaging System for STM32

Post by tobias »

It is some aliasing/harmonics/properties of the nRF51/AMP so the radio waves get repeated on other channels. The sensitivity is so high at 250K that it detects them as well. We haven't found any simple solution to the problem yet but there are plans to improve the low layer protocol with channel hopping etc and then it won't be a problem any more.
Slaxx
Member
Posts: 86
Joined: Tue Mar 03, 2015 11:19 am
Location: Switzerland

Re: Minimal Messaging System for STM32

Post by Slaxx »

Ok, that sounds reasonable.
That means it is better to use 1M or 2M instead?
What about the maximum size that can be transmitted over radio. I saw that the data is limited to 32 bytes (SYSLINK_MTU). Is that just a restriction from you, or did you find out, that there were problems transmitting larger messages?
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Minimal Messaging System for STM32

Post by arnaud »

The maximum size comes form the nRF24 chip used in Crazyradio (PA) and Crazyflie 1.0, they handle only 32Bytes maximum packet size. The nRF51 used in Crazyflie 2.0 can send bigger packets (I think I remember 255Bytes but I am not sure), but the Crazyradio is still limited to 32 so this could be used only between copters and there is not code for that yet anyway.
Slaxx
Member
Posts: 86
Joined: Tue Mar 03, 2015 11:19 am
Location: Switzerland

Re: Minimal Messaging System for STM32

Post by Slaxx »

OK thank you. I made it work to actually send messages to the NRF chip using regular UART. I didn't manage it yet using DMA. Why did you implement DMA over normal UART messages?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Minimal Messaging System for STM32

Post by tobias »

It was an efficient way to implement flow control without using CTS in the UART. Then you can pause/resume the DMA when the nRF51 tells you to.
Post Reply