jfitter: STM32 on the Sunshine Coast

Post Reply
User avatar
jfitter
Posts: 5
Joined: Tue Feb 13, 2018 2:41 pm

jfitter: STM32 on the Sunshine Coast

Post by jfitter » Tue Feb 13, 2018 3:39 pm

Hi. I am from the Sunshine Coast in the state of Queensland, Australia. We have lots of sunshine as the name implies but lots of rain too - recently anyway. I am an engineer and started my career in the mines, eventually through research and consulting to my own business working from home. I do everything from board level design through to firmware development. When you are the only employee it is not an option. I am now working at a nearby University doing part time teaching (physics) and working on a PhD in radar design. I cycle for fitness and do some racing too. I have a son who is part way through his engineering degree majoring in software engineering and fitting it in with a cycling training schedule. He rides for a pro team and is a past world champion on the track so his training commitments are exceptional. Other than my research, my current main project is the development of a dynamic balancing system for small jet turbines. I have a partner in this, a long time friend, and he does all of the machining. The balancer is unique in that it does not require that the rotor be removed from the motor. Data is acquired and filtered by an stm32 and sent over classic bluetooth to a pc, phone or tablet and the software for these devices is already written. The data packets are large and have to be sent very quickly so this is pushing the stmduino to its limits. Other projects in various stages of completion (there are many) are mostly associated with radio controlled aircraft power and control systems, except for my network enabled water tank level transmitter and lately an attempt to turn a two dollar electric wall clock into a network enabled atomic clock.

User avatar
mrburnette
Posts: 2226
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: STM32 on the Sunshine Coast

Post by mrburnette » Tue Feb 13, 2018 7:01 pm

jfitter: Welcome.
Wi-Fi Direct promises device-to-device transfer speeds of up to 250Mbps, while Bluetooth 4.0 promises speeds similar to Bluetooth 3.0 of up to 25Mbps. Both Bluetooth 4.0 and Wi-Fi Direct use the 802.11 networking standard to reach their maximum speeds.
I love the STM32DUINO and the under $2 USD price of Blue Pills. However, the quote above is from PC WORLD and you may want to consider moving to a faster uC, perhaps the ESP32. If you do UDP WiFi transfers, the data transport is even faster. ESP32 has a well developed Arduino core and ESP32 Wemos modules are currently under $5 USD.

Ray

PS: Site administrator Roger Clark lives about 105 hours away by bicycle. .. Maybe meet halfway :lol:

User avatar
jfitter
Posts: 5
Joined: Tue Feb 13, 2018 2:41 pm

Re: STM32 on the Sunshine Coast

Post by jfitter » Wed Feb 14, 2018 12:40 am

Wi-Fi Direct promises device-to-device transfer speeds of up to 250Mbps, while Bluetooth 4.0 promises speeds similar to Bluetooth 3.0 of up to 25Mbps. Both Bluetooth 4.0 and Wi-Fi Direct use the 802.11 networking standard to reach their maximum speeds.
Yes, I have already wasted a lot of time with the esp32. The development environment is not yet mature enough and I found too much did not work or was poorly documented. Furthermore I can't get the speed I want from bt4. Seems it is designed for small packets and short bursts. I also tried wifi, both direct and broadcast, which worked very well and gave me the speed I wanted but was too much trouble for users to setup.

I need to send 1440 byte packets quickly for real time screen updates, and respond to the occaissional single byte command (12 bit sample/degree of revolution/sensor). Classic bt can do this easily and from my testing the blue pill can too if I set the transmit buffer size to about 1k and bit rate to 460k I get a packet rate of about 31hz. Simple hardware, a HC05 module, provides an end solution that require no skill by the user to setup. I could not get bt4 to do this and even if I could the development effort would be endless. I think the reason is the esp32 just does so much. It's a level of complexity way beyond what this application requires.

Using the hc05 I now have a fully working app. The bt link is transparent so I can get on with the core functionality. The reciever is Android or any os with a Java engine. Apple targets may be problematic using classic bt but I will worry about that later.

The only real problem I have is that the enhancements recently made to STMDuino to provide interrupt driven serial transmission uses a single definition for transmit buffer size. When I want one large transmit buffer I get an extra two for free. I have looked at the code carefully and its structure is not easily amenable to fixing this. The usart_dev structure includes static buffers. I would replace these with buffer pointers but I am not familiar enough with the remainder of the code to get this working, and I have my supervisor on my back for a paper for a upcoming conference.

For now I have to live with several K of wasted buffer just to get one large buffer.

User avatar
jfitter
Posts: 5
Joined: Tue Feb 13, 2018 2:41 pm

Re: STM32 on the Sunshine Coast

Post by jfitter » Wed Feb 14, 2018 12:46 am

...PS: Site administrator Roger Clark lives about 105 hours away by bicycle. .. Maybe meet halfway :lol:
Oh, I have done the ride. It's about a thousand miles and ten thousand B-double trucks roaring past. Takes a week for ones nerves to recover :?

User avatar
RogerClark
Posts: 7691
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: STM32 on the Sunshine Coast

Post by RogerClark » Wed Feb 14, 2018 2:39 am

jfitter wrote:
Wed Feb 14, 2018 12:46 am
...PS: Site administrator Roger Clark lives about 105 hours away by bicycle. .. Maybe meet halfway :lol:
Oh, I have done the ride. It's about a thousand miles and ten thousand B-double trucks roaring past. Takes a week for ones nerves to recover :?
LOL

It took us 2 days to drive to the QLD NSW border, when we did a road trip a few years ago. ;-)

Re: BLE

Yep. Its not designed to send large quantities of data.

I think the ESP32 also does BLE Classic, but I've no idea how mature the BLE classic stuff is on the ESP32

You could potentially connect a Blue Pill directly to the phone and use something like HID to send the data e.g. mimic a keyboard
There is a thread about the USB libs, but you'll need to download them separately as I didnt write them, or include them in the Core yet

User avatar
jfitter
Posts: 5
Joined: Tue Feb 13, 2018 2:41 pm

Re: STM32 on the Sunshine Coast

Post by jfitter » Wed Feb 14, 2018 4:06 am

RogerClark wrote:
Wed Feb 14, 2018 2:39 am
I think the ESP32 also does BLE Classic, but I've no idea how mature the BLE classic stuff is on the ESP32

You could potentially connect a Blue Pill directly to the phone and use something like HID to send the data e.g. mimic a keyboard
There is a thread about the USB libs, but you'll need to download them separately as I didnt write them, or include them in the Core yet
I didn't even look at direct connection because it is not in my design specification. You don't even need HID. If the app is written in say B4A the libraries are already built-in for OTG comms, and b4a will allow very easy porting to android, ios, and pc - it makes java.

I did look at classic bt on the esp32 and it will do it but the learning curve is steep and it is very easy in this business to turn a small job into a really big job very quickly :shock:

It would be nice though to have the ability to have different sized buffers for each serial port in stmduino.

User avatar
jfitter
Posts: 5
Joined: Tue Feb 13, 2018 2:41 pm

Re: jfitter: STM32 on the Sunshine Coast

Post by jfitter » Wed Feb 14, 2018 4:24 am

BTW Roger - did you do the STM-Arduino port? If you did, thanks.
It is fantastic. I had it running in 30 minutes and it has not given me any problems since. I put bootloaders into all of my Blue Pills and for most of my work that is enough. I have an stlink and an ocd-h but things need to be pretty serious before I resort to those. The Maple documentation is more than enough to develop code.
Though I have long experience with small procs and c/c++, arduino lets me make stuff very quickly and the under-the-hood bits save much tedious work. I remember a commercial job I did many years ago to make an Egg Turner. A simple job, it ran a motor every few hours that turned eggs in an incubator a half a turn. After some many days (?) it stopped and sounded an alarm. The actual business of turning eggs and keeping time was almost trivial, but the program overheads were larger by far than the functional code. Arduino hides this :D .

User avatar
RogerClark
Posts: 7691
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: jfitter: STM32 on the Sunshine Coast

Post by RogerClark » Wed Feb 14, 2018 4:59 am

@jfitter

The Arduino_STM32 codebase is a long story.

There is info here about where the original codebase came from, https://github.com/rogerclarkmelbourne/ ... nd-history

However, I did a lot of the major initial work, to bring the old style "Arduino 22" (pre 1.0) codebase up to anything valuely like Arduino 1.0 API and beyond.

And I've been managing the codebase and taking PRs and bug reports and running this forum for nearly 3 year now.


BTW. There are 2 other Cores...

Arduino's official one, (mainly supports Nucleo boards and uses the STM HAL API) http://githhub.com/stm32duino
(I'm admin on this account as well)
And STM32_GENERIC, which is @danilef's take on a HAL based Core (mainly used by people with non Nucleo boards that are not BluePill e.g. F4's and L4's etc etc)

Post Reply