EEVblog Electronics Community Forum

Electronics => Microcontrollers => Topic started by: OwO on October 12, 2019, 06:02:36 am

Title: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: OwO on October 12, 2019, 06:02:36 am
I designed a board with a GD32F303 and discovered code for STM32F303 will not run on it (all peripheral accesses don't work), but code targeting STM32F103 does work and all tested peripherals (usb, dma, adc) work correctly. Initially I thought the chip was a relabeled GD32F103 but a detailed reading of the GD32F303 user manual and memory map revealed that the peripherals are identical to the F103. So the GD32F303 really is just a F103 with more ram and flash.
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: lordium on October 12, 2019, 06:37:23 am
Where did you find information that said it would be a drop in replacement? Apart from the name being similar, they are 2 different companies. Are there any information from either of them stating anything like this? Seems like a expectation vs reality problem.
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: ataradov on October 12, 2019, 06:38:54 am
That's why it is a PSA, since many people would have the same expectation. There is really no point in discussing reasons for that for 1000th time.
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: donotdespisethesnake on October 12, 2019, 09:38:10 am
a detailed reading of the GD32F303 user manual and memory map revealed that the peripherals are identical to the F103.

PSA: RTFM !
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: Rasz on October 12, 2019, 12:14:17 pm
Quote from: donotdespisethesnake
PSA: RTFM !

more like PSA: dodgy vendor
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: GromBeestje on October 13, 2019, 02:12:19 pm
Quote from: donotdespisethesnake
PSA: RTFM !

more like PSA: dodgy vendor

I'm more like RTFM on this one.

Quote
So the GD32F303 really is just a F103 with more ram and flash.
The GD32F303 is a Cortex M4, versus an M3 for the F103. And there are more peripherals, like the DAC.  In that sense, the features are like an STM32F303. So, not a drop-in, but offers the same features
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: SiliconWizard on October 13, 2019, 03:27:47 pm
So basically you're using a "clone" IC (at least you apparently chose it for this reason) and expect it to be a full clone, and are miffed when you discover, a bit late, that it's not.

Dunno if it's funny or sad. ;D
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: OwO on October 13, 2019, 05:27:00 pm
Actually makes my job easier because all my existing code are F1 oriented and this saves having to port a lot of stuff. Don't know about the M4 vs M3 part though but binaries built for STM32F103 run on the GD32F303 with no modifications including the peripherals (currently tested: usb, adc, timer, dma, interrupts). I did make a small GD32 specific change though which is to allow running at 96MHz while using usb. I think I will end up porting the NanoVNA UI code to fit my codebase rather than the other way around since I don't feel like porting an outdated version of ChibiOS to this. One thing the gd32 lacks which is a regression is USB DFU, so firmware updates will require a st-link... EDIT: or usb-serial adapter
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: jhpadjustable on October 13, 2019, 10:55:43 pm
One thing the gd32 lacks which is a regression is USB DFU, so firmware updates will require a st-link... EDIT: or usb-serial adapter
I don't think the STM32F1 has a USB DFU bootloader either. If the F103 compatibility is that strong, an F103 bootloader from some random bloke on github might just work out of the box.
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: thm_w on October 16, 2019, 01:21:04 am
I would have done the exact same thing so no blame here. GD32F103 is a straight up drop in replacement, if 303 was not they should put it in the datasheet headline or on their site somewhere. OR differentiate the number at least a bit (FX303 whatever).

This is going to be very confusing because now you can't trust the PN, so any sort of flash size/ram size/etc would be suspect as well. Makes me less likely to use their ICs.
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: jhpadjustable on October 16, 2019, 01:57:39 am
I would have done the exact same thing so no blame here. GD32F103 is a straight up drop in replacement, if 303 was not they should put it in the datasheet headline or on their site somewhere. OR differentiate the number at least a bit (FX303 whatever).
They did. Notice the GD in front? That should be a big flashing neon sign that you're in a different namespace now. Why on earth did you ever assume ST is a standards body?
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: james_s on October 16, 2019, 02:06:05 am
Because so many ICs do follow that convention that the brand prefix is often not even mentioned. I would have made the same assumtion as well. Occasionally old EPROMs have different programming algorithms based on the brand but even those are drop-in replacements from a functional standpoint. I can't actually think of a case I've ever encountered where two ICs with the same part number beyond the vendor prefix were not compatible.
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: langwadt on October 16, 2019, 02:21:29 am
Because so many ICs do follow that convention that the brand prefix is often not even mentioned. I would have made the same assumtion as well. Occasionally old EPROMs have different programming algorithms based on the brand but even those are drop-in replacements from a functional standpoint. I can't actually think of a case I've ever encountered where two ICs with the same part number beyond the vendor prefix were not compatible.

I sure there are lots of analog parts
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: jhpadjustable on October 16, 2019, 02:26:53 pm
Memory and 74 series logic were standardized fairly early on by a proper standards body (JEDEC). Analog was mostly standardized, such as it was, by virtue of second-sourcing agreements and gentlemanly behavior. There aren't enough numbers left for that!  ;D
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: westfw on October 17, 2019, 08:32:46 am
I was vaguely under the impression that the stm32f303 was a a proper superset of the stm32f103...


Other psa: the samc21 chips do not have usb...  (difference between a d20 and d21 is essentially usb.  Difference between c20 and c21 is... CAN.

Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: GromBeestje on October 17, 2019, 06:22:08 pm
Looking at the migration guide STM32F1 to STM32F3 , https://www.st.com/content/ccc/resource/technical/document/application_note/8e/c8/8d/e3/ee/ff/44/e6/DM00073522.pdf/files/DM00073522.pdf/jcr:content/translations/en.DM00073522.pdf (https://www.st.com/content/ccc/resource/technical/document/application_note/8e/c8/8d/e3/ee/ff/44/e6/DM00073522.pdf/files/DM00073522.pdf/jcr:content/translations/en.DM00073522.pdf)

This is true for the peripherals themselves, but they exist at different addresses,. So it won't be binary compatible, but up to high level source compatible (just by replacing the header files)

Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: SL4P on October 20, 2019, 08:21:42 pm
To a large extent, many of those ‘standards’ bodies like JEDEC became pointless when China started turning out real an fake components.
The desire to grab market share with non compliant or simply dodgy parts has polluted the water forever.
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: blueskull on October 20, 2019, 08:34:55 pm
To a large extent, many of those ‘standards’ bodies like JEDEC became pointless when China started turning out real an fake components.
The desire to grab market share with non compliant or simply dodgy parts has polluted the water forever.

To my knowledge, making compatible parts or non JEDEC compliant part is not banned by any trade treaties.
If GigaDevice really wanted to be a dick, they can just put STM32 in their part number and print their own logo. Unless ST registers every single STM32 part number as a trademark, there's nothing illegal about it.
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: SL4P on October 20, 2019, 08:49:49 pm
Nothing illegal, just the data pool is contaminated.
Less reliable than if it had been followed strictly.
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: langwadt on October 20, 2019, 08:53:40 pm
To a large extent, many of those ‘standards’ bodies like JEDEC became pointless when China started turning out real an fake components.
The desire to grab market share with non compliant or simply dodgy parts has polluted the water forever.

To my knowledge, making compatible parts or non JEDEC compliant part is not banned by any trade treaties.
If GigaDevice really wanted to be a dick, they can just put STM32 in their part number and print their own logo. Unless ST registers every single STM32 part number as a trademark, there's nothing illegal about it.

might not be able to register it as a trademark, back in the day Intel tried to trademark i586 (or similar) but it was denied so they started using names that they could get trademarked like Pentium
Title: Re: PSA: GD32F303 is not a drop in substitute for STM32F303
Post by: jhpadjustable on October 20, 2019, 09:38:57 pm
[might not be able to register it as a trademark, back in the day Intel tried to trademark i586 (or similar) but it was denied so they started using names that they could get trademarked like Pentium
Longer: https://tedium.co/2017/05/18/intel-386-486-trademark-battles/

Shorter: a mere number was judged too generic. They did successfully register i586, but lost interest in the whole idea when the i586 approval specifically disclaimed any trademark rights on the number 586 without the i at the front. Where is the outrage over the "321" op amps out there, some with RRIO, some not? :=\