News for hackers. Stuff that matters.
Re:Debugging bare-metal STM32 from the seventh level of hell by the__alchemist on Monday August 08, 2022 @01:08AM (#32382529)
Yikes! That sounds frustrating. As the article concluded with, the way forward appears at the end; ST adding an errata for this.

The elephant in the room: How is the author getting STM32 G4s? I've been F5ing this every day with no luck for months: https://octopart.com/search?q=stm32g4+ceu&currency=USD&specs...

Re:Debugging bare-metal STM32 from the seventh level of hell by dognotdog on Monday August 08, 2022 @08:16AM (#32384582)
I just bought 10 off digikey last week, to have some prototyping stock. Looks like they still got some: https://www.digikey.com/en/products/detail/stmicroelectronic...

Octopart, etc haven't been able to accurately track inventory through this disruption.

Re:Debugging bare-metal STM32 from the seventh level of hell by the__alchemist on Monday August 08, 2022 @10:53AM (#32386133)
Good to know! I've been trying to get hold of certain H7 and G4 variants in a specific footprint. Family and footprint are a hard requirement, but not too picky otherwise. Checking it out.

Of note regarding the one you linked - great find; looks like that Octopart link was bad! I actually have some 491s, and they're great, except that the OSS firmware I'm using them with for this project doesn't support them. Got my own firmware working on them though.

Re:Debugging bare-metal STM32 from the seventh level of hell by jpieper on Monday August 08, 2022 @12:34PM (#32387711)
I'm curious what other OSS firmware is using the G4 series?
Re:Debugging bare-metal STM32 from the seventh level of hell by the__alchemist on Tuesday August 09, 2022 @12:51AM (#32394277)
Betaflight

I also have custom flight controller firmware in Rust that's running fine on G491, but Betaflight needs 47x or 48x.

No luck on getting H7s.

Re:Debugging bare-metal STM32 from the seventh level of hell by girvo on Monday August 08, 2022 @09:44AM (#32385286)
We can buy them in 10s at work without too much gnashing of teeth, but the thousands we need is impossible for another 18 months as far as we can tell.

Edited to add: not that it matters now, we moved to a different MCU that we could get larger shipments of, and we’re lucky enough our application of them can be flexible enough to do so!

Re:Debugging bare-metal STM32 from the seventh level of hell by jpieper on Monday August 08, 2022 @04:10AM (#32383347)
Order far in advance....? These particular chips arrived more than a year ago.

But yes, the shortage is hitting hard here too. The last tray I received was one year ago, after which all orders have been unfulfilled.

Re:Debugging bare-metal STM32 from the seventh level of hell by realcertify on Monday August 08, 2022 @01:34AM (#32382626)
There's plenty of STM32 of any flavor in China. Alibaba is a good source. There may be fakes though, but reputable resellers (pay attention to reviews and tenure) normally sell genuine chips.
Re:Debugging bare-metal STM32 from the seventh level of hell by pabs3 on Monday August 08, 2022 @02:48AM (#32382962)
Are fakes of lesser quality? How do you tell fake from genuine?
Re:Debugging bare-metal STM32 from the seventh level of hell by kragen on Monday August 08, 2022 @04:18AM (#32383378)
I've gotten some Blue Pills with (properly labeled) CKS32s on them, which might be of lesser quality, but I've also seen people reporting getting Blue Pills with (properly labeled) GD32s, which are higher quality than the ST part, at least in the sense that they run successfully at higher clock speeds. (I couldn't tell you if they have more problems turning on many peripherals at close-together times, or if they have more noise on their ADCs, or something.)
Re:Debugging bare-metal STM32 from the seventh level of hell by civilitty on Monday August 08, 2022 @05:31PM (#32391298)
You have to research the counterfeit market for each chip/product series. There's no hard and fast rule for their quality because many of them come from the same factories that make the real chips when unscrupulous fabs have shadow shifts manufacturing their clients' designs for themselves or just straight up copy and rebrand it.
Re:Debugging bare-metal STM32 from the seventh level of hell by the__alchemist on Monday August 08, 2022 @01:50AM (#32382697)
Thanks for the tip! Will check that out. Worth taking the risk.
Re:Debugging bare-metal STM32 from the seventh level of hell by seidleroni on Monday August 08, 2022 @07:42AM (#32384364)
Getting samples of G4's was pretty easy. Since its a fairly new part, there was a large stock that distributors had for engineering samples. The story is very different for things like the F5/F7's and even getting small sample volumes is very hard.
Re:Debugging bare-metal STM32 from the seventh level of hell by jhallenworld on Monday August 08, 2022 @01:48AM (#32382687)
If you can use Cortex-M0+ (so not likely for this project, BLDC where you want floating point), maybe think about RP2040 (Raspberry Pi Pico chip)? More than 100K of them in stock at Digikey, only $1 each... But they come in only one package type, and use external flash (an advantage, IMHO).

I've recently started looking at them. The SDK is nice except that they chose to use CMake. I designed it out:

https://github.com/nklabs/libnklabs-pico

Re:Debugging bare-metal STM32 from the seventh level of hell by dmitrygr on Monday August 08, 2022 @02:16AM (#32382822)
> an advantage, IMHO

it isn't

An extra chip means higher cost to produce & assemble board, larger board size, more pins wasted on this nonsense, most fast-edge signals to route, more passives, extra risk to handle for one extra chip being out of stock, and it is much easier to extract firmware than even from a "protected" stm32

Also wasting RAM (and power for it) on code, or random (between high and very high) latency of XIP from SPI flash

Re:Debugging bare-metal STM32 from the seventh level of hell by jhallenworld on Monday August 08, 2022 @02:23AM (#32382847)
But balanced against basically unlimited flash size. Many of my projects end up having an external SPI-flash for one reason or another anyway.

Another similar chip is the i.MX rt1020 from NXP (except Cortex-M7 and way more expensive). The one gotcha was that there was only one QSPI-flash controller even though there were two ports. It meant that the extra port (which we assumed would be available during architecture) was not fully usable without interfering with the firmware.

Re:Debugging bare-metal STM32 from the seventh level of hell by the__alchemist on Monday August 08, 2022 @03:23AM (#32383100)
You can still get that with chips that have onboard flash, via QSPI or OctoSPI.
Re:Debugging bare-metal STM32 from the seventh level of hell by dmitrygr on Monday August 08, 2022 @02:29AM (#32382869)
> Many of my projects end up having an external SPI-flash for one reason or another anyway.

for what? What sort of possible thing would you need to do on a c-m0 that needs more than 128K of CODE!?

Re:Debugging bare-metal STM32 from the seventh level of hell by jhallenworld on Monday August 08, 2022 @02:40AM (#32382927)
Not so much for code, but lots of use for persistent data (logs, databases, etc.). Only a part of it would be used for XIP. Also with more flash space it's easy to have multiple banks for safe firmware update and the like.
Re:Debugging bare-metal STM32 from the seventh level of hell by dmitrygr on Monday August 08, 2022 @03:01PM (#32389540)
> logs, databases

in NOR flash???

:cringe:

Re:Debugging bare-metal STM32 from the seventh level of hell by jhallenworld on Wednesday August 10, 2022 @02:41PM (#32416611)
NOR is more durable than NAND (but smaller, more expensive per bit), but yes you have to be careful with logs. In most recent case, it was in the 10s of small records per day.
Re:Debugging bare-metal STM32 from the seventh level of hell by kragen on Monday August 08, 2022 @04:13AM (#32383363)
Wait, wasn't there some guy who got an entire Linux system booting on a microcontroller that's smaller than a Cortex-M0? https://dmitry.gr/?r=05.Projects&proj=07.%20Linux%20on%208bi...
Re:Debugging bare-metal STM32 from the seventh level of hell by dmitrygr on Monday August 08, 2022 @12:39PM (#32387779)
Yup, I did. that’s why I ask
Re:Debugging bare-metal STM32 from the seventh level of hell by HeyLaughingBoy on Monday August 08, 2022 @12:08PM (#32387314)
The libraries you pull in can be big. Add, e.g., LWIP for internet, USB filesystem management (data logging and USB firmware update), code to properly manage OTA or Ethernet updates, text strings, especially in multiple languages, etc.

What seems like a huge amount of Flash disappears quickly.

Re:Debugging bare-metal STM32 from the seventh level of hell by lnsru on Monday August 08, 2022 @02:43AM (#32382941)
ADC calibration data. Plus some ID data. Plus log of very nasty events specific to my application. And there comes external SPI flash.