GD32 version of Wideband Controller

Hardware inside and outside of the ECU
Post Reply
puff
contributor
contributor
Posts: 2923
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

GD32 version of Wideband Controller

Post by puff »

(Fork of https://rusefi.com/forum/viewtopic.php?f=4&t=1856 thread)

considering this ongoing crisis, why not GD32?
GD32F190 is a 5-V series.
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

puff wrote:
Thu Apr 01, 2021 6:13 pm
considering this ongoing crisis, why not GD32?
GD32F190 is a 5-V series.
This question was raised at https://github.com/mck1117/proteus/issues/94 and I agree that cost/benefit is just not there. It's not like GD32 is more available, overall it's even LESS available.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
mck1117
running engine in first post
running engine in first post
Posts: 1275
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish

Re: GD32 version of Wideband Controller

Post by mck1117 »

puff wrote:
Thu Apr 01, 2021 6:13 pm
considering this ongoing crisis, why not GD32?
GD32F190 is a 5-V series.
I don't think GD32 will necessarily have any better availability than ST. They're fabricated using essentially the same wafers. There is not really much point in trying to redesign during a shortage like this, since by the time you've done your big engineering work to redesign, the chips are back in stock.
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

mck1117 wrote:
Thu Apr 01, 2021 6:20 pm
There is not really much point in trying to redesign during a shortage like this, since by the time you've done your big engineering work to redesign, the chips are back in stock.
Does this apply to GD or does this apply to original 48 pad package ask?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2923
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: GD32 version of Wideband Controller

Post by puff »

I thought that GD was a full-cycle manufacturer. Do they source wafers from some other companies?
People say, this crisis will last for at least a year.
Changing a package in the PCB probably takes a few hours. If you are switching to a different package within the same MCU, probably there won't be too much trouble to update the code. But anyway there are no guarrantees that by the time you send your board to fabrication, these parts are still in stock.
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

I think I will try GD32 as a variation of https://rusefi.com/forum/viewtopic.php?f=4&t=2200
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

I have two boards wideband boards with GD32F190!

It's the same stm32f103 board with zero modes so it powers the 5v-capable GD32F190 with 3v.

On the bright side I get
Debug: 135 173 stlink_usb.c:2014 stlink_usb_idcode(): IDCODE: 0x1BA01477
which is valid core id so there is _some_ life. That's the end of good news - in other news I receive
Debug: 141 174 stlink_usb.c:1124 stlink_usb_error_check(): unknown/unexpected STLINK status code 0x5
Debug: 142 174 target.c:2630 target_read_u32(): address: 0xe000ed00 failed


full log attached
Attachments
gd32f190_stlink-v3.txt
(16.07 KiB) Downloaded 62 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2923
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: GD32 version of Wideband Controller

Post by puff »

why is it all about stm32f1x.cpu?
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

GD32F130 version has arrived and it's more or less the same exact error when I try to flash it with openocd via ST-Link/v3

At this point my options to explore are
1) UART bootloader
2) TIL that sagger has https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/
3) st-link/v2 instead of st-link/v3 doubt this would help
4) place a new order for GD32F103 boards instead of GD32F130 boards
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

1) UART bootloader

Well-well. No bilking of LED :(
image.png
image.png (127.62 KiB) Viewed 3135 times
image.png
image.png (19.73 KiB) Viewed 3135 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2923
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: GD32 version of Wideband Controller

Post by puff »

segger worked just fine for me with 190, but you'd probably have to reflash your stlink into jlink (google for that free reflash tool, the operation is reversable)
btw, with segger you'd have to choose the proper µcu.
puff
contributor
contributor
Posts: 2923
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: GD32 version of Wideband Controller

Post by puff »

ps. are you trying to upload the same very .bin file you used with stm32? afaik, gd chips have sligthly different registers and addresses, so, the firmware should be different.
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

http://gd32mcu.com/en/download/7?kw=GD32F1 is the source of GD32 truth

TL,DR: the mistake we've made was to assume that GDF1x0 is close to STM32F103 while in reality it's only GDF10x which is similar to STM32F103.

Let's look at IRQ enums

stm32f10x.h

Code: Select all

/******  STM32 specific Interrupt Numbers *********************************************************/
  WWDG_IRQn                   = 0,      /*!< Window WatchDog Interrupt                            */
  PVD_IRQn                    = 1,      /*!< PVD through EXTI Line detection Interrupt            */
  TAMPER_IRQn                 = 2,      /*!< Tamper Interrupt                                     */
  RTC_IRQn                    = 3,      /*!< RTC global Interrupt                                 */
  FLASH_IRQn                  = 4,      /*!< FLASH global Interrupt                               */
  RCC_IRQn                    = 5,      /*!< RCC global Interrupt                                 */
  EXTI0_IRQn                  = 6,      /*!< EXTI Line0 Interrupt                                 */
  EXTI1_IRQn                  = 7,      /*!< EXTI Line1 Interrupt                                 */
  EXTI2_IRQn                  = 8,      /*!< EXTI Line2 Interrupt                                 */
  EXTI3_IRQn                  = 9,      /*!< EXTI Line3 Interrupt                                 */
  EXTI4_IRQn                  = 10,     /*!< EXTI Line4 Interrupt                                 */
compare to
gd32f10x.h

Code: Select all

    /* interruput numbers */
    WWDGT_IRQn                   = 0,      /*!< window watchDog timer interrupt                          */
    LVD_IRQn                     = 1,      /*!< LVD through EXTI line detect interrupt                   */
    TAMPER_IRQn                  = 2,      /*!< tamper through EXTI line detect                          */
    RTC_IRQn                     = 3,      /*!< RTC through EXTI line interrupt                          */
    FMC_IRQn                     = 4,      /*!< FMC interrupt                                            */
    RCU_CTC_IRQn                 = 5,      /*!< RCU and CTC interrupt                                    */
    EXTI0_IRQn                   = 6,      /*!< EXTI line 0 interrupts                                   */
    EXTI1_IRQn                   = 7,      /*!< EXTI line 1 interrupts                                   */
    EXTI2_IRQn                   = 8,      /*!< EXTI line 2 interrupts                                   */
    EXTI3_IRQn                   = 9,      /*!< EXTI line 3 interrupts                                   */
    EXTI4_IRQn                   = 10,     /*!< EXTI line 4 interrupts                                   */
note how "1" value has different names PVD_IRQn vs LVD_IRQn but overall table is similar

Now let's look at gd32f1x0.h and suddenly IRQ enums are totally different

Code: Select all

    WWDGT_IRQn                   = 0,      /*!< window watchdog timer interrupt                          */
    LVD_IRQn                     = 1,      /*!< LVD through EXTI line detect interrupt                   */
    RTC_IRQn                     = 2,      /*!< RTC through EXTI line interrupt                          */
    FMC_IRQn                     = 3,      /*!< FMC interrupt                                            */
    RCU_IRQn                     = 4,      /*!< RCU interrupt                                            */
    EXTI0_1_IRQn                 = 5,      /*!< EXTI line 0 and 1 interrupts                             */
    EXTI2_3_IRQn                 = 6,      /*!< EXTI line 2 and 3 interrupts                             */
    EXTI4_15_IRQn                = 7,      /*!< EXTI line 4 to 15 interrupts                             */
    TSI_IRQn                     = 8,      /*!< TSI Interrupt                                            */
    DMA_Channel0_IRQn            = 9,      /*!< DMA channel 0 interrupt                                  */
    DMA_Channel1_2_IRQn          = 10,     /*!< DMA channel 1 and channel 2 interrupts                   */
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2923
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: GD32 version of Wideband Controller

Post by puff »

Yes, hate the blue pill with clone MCU on it. In my case I have a CKS32F103… instead of STM32F103…
However, if you do end up with one, there is a way to get it working with OpenOCD. >>
1. Use OpenOCD as your debugger (GDB will not work)
2. Find the config file : stm32f1x.cfg
Location is similar to this : >>
C:\ST\STM32CubeIDE_1.3.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.debug.openocd_1.3.0.202002181050\resources\openocd\st_scripts\target
3. Add the following near the top of stm32f1x.cfg (before the first If – statement):
set CPUTAPID 0
The zero tells OpenOCD to ignore id numbers, which means all clones or genuine MCUs will work.
4. Save the changes. Now your flash and debug should work.

Note: If you change to OpenOCD without changing “stm32f1x.cfg”, you will get the following Error: “UNEXPECTED idcode: 0x2ba01477…. Expected: 0x1ba01477”, and you will again be stuck.

Information Source: http://openocd.org/doc/html/TAP-Declaration.html#TAP-Declaration-Command
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

First batch of GD32 progress: I've purchased some legit GD32F103CBT6 from lcsc and swapped one of these on a blue pill. We have LED blinking with test project build for stm32F103, with official st-link utility command line doing the flashing
image.png
image.png (33.78 KiB) Viewed 2730 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

More good news for GD32F103CBT6: just validated UART and CANs with https://github.com/rusefi/rusefi/tree/master/misc/stm32f1_test_project test project
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

WOW what are all those F103C vendors?! Some in stock at JLC some in stock at LCSC

GD32F103C8T6 datasheet in English
RX32F103CBT7 datasheet partially in English
APM32F103C8T6 datasheet in Chinese
HK32F103 HK32F103C8T6 37 pages datasheet in Chinese
MS32F103C8T6 58 pages datasheet in Chinese
MG32F103C9T6 datasheet in Chinese
FCM32F103CBT6 you can guess
MM32F103 not compatible with stm32 English datasheet!
image.png
image.png (169.88 KiB) Viewed 1069 times
image.png
image.png (90.07 KiB) Viewed 1069 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 12803
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: GD32 version of Wideband Controller

Post by AndreyB »

Just stumbled over compatibility sumup between GD32 and STM32_V2.0.pdf
Attachments
compatibility sumup between GD32 and STM32_V2.0.pdf
(1.13 MiB) Downloaded 38 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Post Reply