Page 1 of 1
Minimal Messaging System for STM32
Posted: Mon Aug 17, 2015 11:17 am
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?
Re: Minimal Messaging System for STM32
Posted: Mon Aug 17, 2015 5:15 pm
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.
Re: Minimal Messaging System for STM32
Posted: Tue Aug 18, 2015 8:49 am
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.
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
Re: Minimal Messaging System for STM32
Posted: Thu Aug 20, 2015 10:58 am
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.
Re: Minimal Messaging System for STM32
Posted: Thu Aug 20, 2015 11:14 am
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?
Re: Minimal Messaging System for STM32
Posted: Thu Aug 20, 2015 4:31 pm
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.
Re: Minimal Messaging System for STM32
Posted: Fri Aug 21, 2015 1:47 pm
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?
Re: Minimal Messaging System for STM32
Posted: Fri Aug 21, 2015 3:05 pm
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.