Live data from Hacker News

How to flash an LED: writing ARM assembly for an STM32 microcontroller

mcla.ug

1–10 of 68 posts

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#3
post #2

Anybody got USB communication (CDC class) working on this platform without the proprietary libs?

no, i spent months on this, and the answer is no

They use IP from synopsis, but synopsis refuses to allow their docs to be published so every manufacturer has to read them and regurgitate them into their own docs in their own words. In any case official STM docs are incomplete. See their driver source - it accesses undocumented registers and sets undocumented bits in documented regs. Without them the usb core will not start or run.

Your options are to carefully rewrite STM's libs (which are based on real synopsis docs and DO work) or use them as is. Both solutions IMHO leave you subject to STM's EULA and such

this is the #1 issue in stm32

a close #2 is the their so-smart-it-is-useless i2c controller. I know of no project that uses it. Everyone bitbangs i2c master on stm32. The hardware unit is very easy to wedge to a point where only a power cycle unwedges it.

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#4
post #2

Anybody got USB communication (CDC class) working on this platform without the proprietary libs?

I don't have experience with this, but from talking to people who do, there are indeed open source implementations. They say the documentation is a bit confusing, but it does describe everything.

This Rust library is an abstract USB library that can implement CDC serial https://docs.rs/usb-device/0.2.5/usb_device/, and this library connects it to the STM32 USB peripheral https://github.com/stm32-rs/stm32-usbd

Examples here: https://github.com/stm32-rs/stm32-usbd-examples

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#6
post #3
post #2

Anybody got USB communication (CDC class) working on this platform without the proprietary libs?

no, i spent months on this, and the answer is no They use IP from synopsis, but synopsis refuses to allow their docs to be published so every manufacturer has to read them and regurgitate them into their own docs in their own words . In any case official STM docs are incomplete. See their driver source - it accesses undocumented registers and sets undocumented bits in documented regs. Without them the usb core will n…

It's not a rumor. You have to be a Synopsys licensee to see the docs on their IP cores.

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#7
post #5

@author: 1 @ Set BR8 field in GPIOA_BSRR, to clear GPIOA8 2 movw r1, #0x0000 3 movt r1, #0x0100 you can just use a mov to get that value. Any 8-bit value shifted left any number of bits is synthesizable using one MOV

This is true! If I was writing something to be optimal speed- and size-wise, I'd do that. I think I just liked the consistency with the other parts of the code where using both was necessary :)

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#8
post #4
post #2

Anybody got USB communication (CDC class) working on this platform without the proprietary libs?

I don't have experience with this, but from talking to people who do, there are indeed open source implementations. They say the documentation is a bit confusing, but it does describe everything. This Rust library is an abstract USB library that can implement CDC serial https://docs.rs/usb-device/0.2.5/usb_device/ , and this library connects it to the STM32 USB peripheral https://github.com/stm32-rs/stm32-usbd Exampl…

those open source libs use undocumented regs documented and thus are based on STM lib. License in question thus

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#9
post #3
post #2

Anybody got USB communication (CDC class) working on this platform without the proprietary libs?

no, i spent months on this, and the answer is no They use IP from synopsis, but synopsis refuses to allow their docs to be published so every manufacturer has to read them and regurgitate them into their own docs in their own words . In any case official STM docs are incomplete. See their driver source - it accesses undocumented registers and sets undocumented bits in documented regs. Without them the usb core will n…

Can you point to where the undocumented registers are used in the source? I don't see anything obvious that fits that definition in:

https://github.com/STMicroelectronics/STM32CubeF4/tree/maste...

(I've chosen the version for STM32F4 arbitrarily; if there's something similar in one of their other USB support libraries, feel free to point to that instead.)

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#10
post #7
post #5

@author: 1 @ Set BR8 field in GPIOA_BSRR, to clear GPIOA8 2 movw r1, #0x0000 3 movt r1, #0x0100 you can just use a mov to get that value. Any 8-bit value shifted left any number of bits is synthesizable using one MOV

This is true! If I was writing something to be optimal speed- and size-wise, I'd do that. I think I just liked the consistency with the other parts of the code where using both was necessary :)

Oh actually I was being sleepy and hadn't understood what you'd said! I hadn't realised you could do that actually, neat, thanks!

So you could do `mov r1, #0x01000000` right? nice.

Post reply on HN