STM32Dunio and Android

Post here first, or if you can't find a relevant section!
Post Reply
CodeWizardette
Posts: 4
Joined: Sun Nov 12, 2023 11:25 am

STM32Dunio and Android

Post by CodeWizardette »

Hey STM32Dunio Community,

I hope you're all doing awesome! I'm diving into a cool project. :shock:
I've got a good handle on Python, but I'm totally new to the world of STM32 Bluepill and Android USB communication.
I'm reaching out to you, the experts, because I could really use some guidance.

I Need Help With:

I'm pretty comfortable with Python, but this STM32 Bluepill and Android thing? Total mystery to me!
Figuring out USB permissions and security? No clue where to start.
I want to make sure the data I'm working with is super secure. Any tips on best practices for that?

My Burning Questions:

What software should I load onto my STM32 Bluepill board?
Any pointers on setting up USB permissions in my Android app?
How can I ensure top-notch data security throughout the communication process?
Are there any must-know libraries or sample projects you'd recommend for STM32Dunio and Android?

Why I Need Your Help:
I'm here to learn, and I'm counting on your expertise!
Your personal experiences and advice would mean the world to me.
Looking forward to hearing your thoughts!

Board :bluepill
core: C8T6
all is ok endpoints data type but says me that usb is bussy onn computer
using kviy and pyusb
I am capturing the device with the Endor ID and Product ID, but I am experiencing issues with data reception or transmission.

Cheers!
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: STM32Dunio and Android

Post by fpiSTM »

Welcome @CodeWizardette
As stated on GH never tested nor expertise on this.
Hope some members have some input for you.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: STM32Dunio and Android

Post by ag123 »

if you prefer python for a start
Adafruit has a stm32f405 feather express (rather pricy, but that it is a fast microcontroller has 1 Meg flash and 512 k sram, deemed generous among microcontrollers, and lots of on-chip peripherals)
https://learn.adafruit.com/adafruit-stm ... er-express
that one can run circuit python (see the guide) or micro python\
it works with stm32duino (in the guide) and as follows
(stm32f405 has on chip hardware crypto if you are looking for that, but I've not tried it
https://www.st.com/resource/en/referenc ... ronics.pdf
)

for stm32duino (STM core) the repository is here
https://github.com/stm32duino/Arduino_Core_STM32
and a wiki is here
https://github.com/stm32duino/Arduino_Core_STM32/wiki

For stm32duino, it is recommended to get at least stm32f401ccu or stm32f411cxx as this has more ram and flash like 64k SRAM and 128k flash
https://www.st.com/en/microcontrollers- ... 401cc.html
https://www.st.com/en/microcontrollers- ... 411ce.html
and has a FPU on chip + it has on chip cache (branded as 'ART accelerator'), that can speed up in flash codes like from several wait states to like 0 wait states if the code is in cache. so stm32f4xx are faster than stm32f103xx and other m3 chips for the same MHz.
More flash (for code storage) and SRAM are also important as the stm32duino core has a bit of 'bulk' as in part it supports practically chips across the whole stm32 series. The benefit of accommodating that little bulk is that the same sketch made for one chip e.g. stm32f103 can easily be ported to another chip e.g. stm32f4xx, stm32f7xx, stm32h7xx etc by a simple selecting a different board and re-compile.

Assuming that your board has the USB connection setup.
e.g. like one of those 'pill boards'
https://github.com/WeActStudio/WeActStu ... iSTM32F4x1
for Android, I'm not familiar with that, but that STM core (https://github.com/stm32duino/Arduino_Core_STM32) has USB (CDC) Serial. you need to select that from the Arduino IDE menu and compile/build with that, so that it creates a 'virtual com port' when it is connected to the host e.g. a Windows/Linux PC / laptop.
that can communicate via the usual

Code: Select all

Serial.println("hello world");
style comms.
In the same way for Android, that 'virtual com port' works the same way as USB (CDC) serial while connecting over usb to say an Android phone / device. I did a google search and stumbled into this 'library' maybe you could take a look at it.
https://github.com/mik3y/usb-serial-for-android

There is yet another way which is for 'advanced' users, e.g. I've not yet tried it nor knows how to work that is to get e.g.
https://github.com/stm32duino/Arduino_C ... -64-boards
that P-NUCLEO-WB55 Bluetooth 5 and 802.15.4
https://www.st.com/en/evaluation-tools/ ... -wb55.html
this one can do Bluetooth LE, it is a big win to go fully wireless. But that I've not tried it, hence can't advise ahead of that.
But that it may be worth getting and learning / trying it out.

I'd suggest get a stm32f4xx as above and start with that as it is 'easier' for beginners, given more flash and ram and a better chip (than stm32f103) for a start. the same stm core (https://github.com/stm32duino/Arduino_Core_STM32) can build sketches for stm32f103c8 (blue pill) though, just that stm32f103c8 normally has 64k flash and 20k sram. and won't have that FPU and fancy 'ART accelerator' stuff.
CodeWizardette
Posts: 4
Joined: Sun Nov 12, 2023 11:25 am

Re: STM32Dunio and Android

Post by CodeWizardette »

fpiSTM wrote: Tue Nov 14, 2023 9:00 am Welcome @CodeWizardette
As stated on GH never tested nor expertise on this.
Hope some members have some input for you.
Thank you! Appreciate any help or input you can provide
CodeWizardette
Posts: 4
Joined: Sun Nov 12, 2023 11:25 am

Re: STM32Dunio and Android

Post by CodeWizardette »

ag123 wrote: Tue Nov 14, 2023 9:07 am if you prefer python for a start
Thanks for the detailed information! the USB (CDC) Serial communication information is particularly useful for connecting to Android. I'll explore the USB-Serial for Android library you mentioned. Thanks again for the guidance!
Post Reply

Return to “General discussion”