Support for STM32G0B1

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

User avatar
windsor
Posts: 1
Joined: Sat Sep 04, 2021 8:59 pm
Location: Oakland, California, USA.

Support for STM32G0B1

Postby windsor » Sat Sep 04, 2021 9:22 pm

Hi, I'm curious if there is support planned for STM32G0B1xx devices? For example the STM32G0B1RE that is found on NUCLEO-G0B1RE.

EDIT: Reason why I'm asking: I have a tray of 200pcs STM32G0B1KE. :D

Best regards from California,

Windsor

User avatar
Giovanni
Site Admin
Posts: 13751
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 922 times
Been thanked: 787 times
Contact:

Re: Support for STM32G0B1

Postby Giovanni » Sun Sep 05, 2021 7:26 am

Hi,

Eventually it will be supported, no immediate plans however.

Giovanni

fractal
Posts: 11
Joined: Mon Oct 28, 2013 12:13 pm
Been thanked: 1 time

Re: Support for STM32G0B1

Postby fractal » Wed Sep 08, 2021 5:01 pm

I was just about to create a post with the same title, allow me to hijack this one. I have some STM32G0B1KC and NUCLEO-G0B1R and am torn between getting used to STM32cube-things and freeRTOS or getting the B1 subfamily working with chibios/chibistudio.

I have already started adapting the existing G0 port to cover the B1/C1 family, but there are actually a lot of differences compared to the 51/71 and one or two things appear to be unique to these new devices.

Could someone help me get an overview what needs to be done get get these devices and standard peripherals (e.g. I need USB, not USB PD) working?

Differences I see
1) more flash (up to 512kB), more ram (144kB)
- one (128kB) or two banks (>128kB)
2) bigger packages, including port E
3) DMA2 with 5 channels
4) one more comparator (COMP3)
5) one more timer (TIM4)
6) one more I2C (I2C3)
7) two more USART (5 & 6), one of them advanced (USART1-3)
8) one more LPUART (LPUART2)
9) one more SPI (SPI3)
10) USB 2 FS
11) 2 FDCANs

Done so far
Port:
stm32_registry.h: adding new section
stm32_rcc: add DMA2 and USB
stm32_isr: add DMA2 and USB
hal_lld.h: add platform, CAN, CLK48, USB
platform.mk: add USB and CAN

RCCv1
stm32_hsi48.inc: the 48 MHz oscillator is present on G071, but not sure what for, anyway it wasnt in the code. The registers on this family seem to differ from the code, HSI48ON and HSI48RDY are in RCC->CR instead of RCC->CRRCR, so I added an #if check for STM32G0XX to enable and disable

USBv1
- stm32_usb.h: the USB memory seems to be located at USB_DRD_PMAADDR instead of USB1_PMAADDR or USB_PMAADDR, so I added that option
- hal_usb_lld.h: the USB has two restart bits (USB_CNTR_L1RES | USB_CNTR_L2RES) instead of one (USB_CNTR_RESUME), I didnt check the significance of L1/L2 and merely added a #if for STM32G0XX which sets both to the wakeup

- linker file: I created some for my devices with 256kB and 512kB, merely adding larger ram/flash values and a second flash bank (not used)

- openOCD: there is support in the latest builds, but I think there is something wrong, I got undefined exceptions with it, which I didnt have with ST tools, may be related to the two banks and unfinished support at openOCD

With these edits the G071 demo project compiles and loads to both my HW and the nucleo, but
1) with openOCD it will only end up with an unhandled exception.
2) with stm32cubeprogrammer it will run, but not allow debugging - with chibios running it connects only under HW reset. Something wrong with the hal init I suspect, the GPIO pins for SWD are configured correctly (as they were in the G071 demo) and I cant find an error with the new poert E.

I would be happy about any help in getting this running, finished and into chibios.
Thomas

User avatar
Giovanni
Site Admin
Posts: 13751
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 922 times
Been thanked: 787 times
Contact:

Re: Support for STM32G0B1

Postby Giovanni » Wed Sep 08, 2021 6:49 pm

Hi,

You did most of it, just mcuconf.h generator tool should be added. Probably you also need to add specific board files.

I will try to get one of those boards.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 13751
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 922 times
Been thanked: 787 times
Contact:

Re: Support for STM32G0B1

Postby Giovanni » Sat Sep 18, 2021 1:54 pm

Hi,

Support and a demo added in trunk, there were some unexpected changes required because the G0B1 shares interrupts in new ways (and I did not mention that in my previous post). Now it should be fine but it was may more complex than I anticipated...

Please post your files because I have not yet added the RCC changes.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 7 guests