Page 1 of 1

I2C HardWire doesnt work with GD32F103CB

Posted: Sun Dec 18, 2016 4:34 pm
by ccanovas
After many hours and many tests, I2C HardWire doesn't work.
I use the i2c_scanner_hwire nothing happens everything freeze.

My investigations :

1 ) call _i2c_irq_priority_fixup() make the microcontroller hangs.
2) wait_for_state_change() wait for ever.
3) _i2c_irq_handler() seems to be called heavily.

The software wire works but not so stable with my I2C device.

Re: I2C HardWire doesnt work with GD32F103CB

Posted: Sun Dec 18, 2016 7:40 pm
by RogerClark
It has become clear over the last year, that the GD32 is not a direct replacement for the STM32, Despite GD's claims. so I guess I should just remove support for it from the repo.

I don't have time to resolve amy such issues, and GD32 boards are no longer available cheaply, so it seems pointless to continue with them.

Re: I2C HardWire doesnt work with GD32F103CB

Posted: Mon Dec 19, 2016 9:38 am
by ccanovas
Hi Roger,

First, Thank you for yours jobs,contributions and those libraries. It makes the stm32 comes in Arduino world :D .

I agree with you about the GD32xxx , on the paper they are look like equal to the STM32xxx but in the real world that is not exactly the case.

I'd like to contribute to the GD32xxx libs improvments and bug fixes. I've downloaded the datasheets and i will dig a little bit and try to find an issue to those troubles.Gigadevice provides a libs to make the GD32xxx works with Keil. i've download that and Keil. The first things i saw is the interrupts defintion table seems to be slightly different to the STM32xxx wich can explains the behavior, because when the interrupt I2C event is enable it acts as timer interrupt or pin change state interrupt or something like this (that an hypothesis). Anyway that sounds like bad mapping of interrupt vector.
The bootstrap code provided by Gigadevice matches with your patch to make the bus works with the correct frequency (divider are the same and registers settings also).
The software I2C lib works but it is not so stable because the frequency SCLK seems to be not very stable.
The USB serial works fine.

Re: I2C HardWire doesnt work with GD32F103CB

Posted: Mon Dec 19, 2016 10:32 pm
by RogerClark


I know the basics work on the GD32, and I made a few changes to allow clock speeds above 72MHz to work with USB, using the additional bit in the USB divider PLL.

But I couldnt get the ILI9341 display SPI example to work, so there seems to be some problem with SPI or possibly just the DMA SPI that the high speed STM32 lib for the ILI9341 uses.

Unfortunately, there are so many other things going on with the STM32 (and ST's own core for this board), as well as my work commitments that I can't find the time to work out why the G32 has problems.

But I'm happy to accept PRs as fixes, as long as those fixes are done via #ifdef's in the code.

As any change that wasnt just in an ifdef would need extensive testing on many different STM32 boards, under a variety of scenarios - and unfortunately I don't have any time :-(