Closed edward-noe closed 2 years ago
This commit uses https://github.com/solarcaratuva/mbed-os to update Mbed OS to 6.15.1.
Updating to 6.15.1 required updating Common/src/TARGET_STM32G473CET6x/PinNames.h. Dipesh added the original version of this file by running STM32CubeMX to configure pins manually. MbedOS also carries a version of this file for a similar target to ours. I modified the file based roughly on the changes made to the Mbed version since Dipesh added the file (https://github.com/ARMmbed/mbed-os/commits/mbed-os-6.15.1/targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G474xE/TARGET_NUCLEO_G474RE/PinNames.h).
For Common/src/TARGET_STM32G473CET6x/PeripheralPins.c, I took a similar approach and updated based on these commits (https://github.com/ARMmbed/mbed-os/commits/mbed-os-6.15.1/targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G474xE/TARGET_NUCLEO_G474RE/PeripheralPins.c). However, this was not required for our code to compile with Mbed 6.15.1.
The above changes were enough to get Mbed 6.15 working on all the boards except for the Motor board, which ran into an assertion related to I2C timing (https://github.com/ARMmbed/mbed-os/blob/mbed-os-6.15.1/targets/TARGET_STM/i2c_api.c#L2001). The problem was related to our system clock configuration. The system_clock.c file we were using was copied from an earlier version of Mbed (https://github.com/ARMmbed/mbed-os/blob/mbed-os-6.3.0/targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G474xx/TARGET_NUCLEO_G474RE/system_clock.c). This file was designed for the Nucleo G474RE board, which uses a 24 MHz external oscillator. This resulted in our system clock being lower than intended, which was also not a "default" clock speed supported by Mbed I2C. I used the latest version of system_clock.c from Mbed (https://github.com/ARMmbed/mbed-os/blob/mbed-os-6.15.1/targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G474xE/system_clock.c) and modified the SetSysClock_PLL_HSE function to handle our custom board.
This commit uses https://github.com/solarcaratuva/mbed-os to update Mbed OS to 6.15.1.
Updating to 6.15.1 required updating Common/src/TARGET_STM32G473CET6x/PinNames.h. Dipesh added the original version of this file by running STM32CubeMX to configure pins manually. MbedOS also carries a version of this file for a similar target to ours. I modified the file based roughly on the changes made to the Mbed version since Dipesh added the file (https://github.com/ARMmbed/mbed-os/commits/mbed-os-6.15.1/targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G474xE/TARGET_NUCLEO_G474RE/PinNames.h).
For Common/src/TARGET_STM32G473CET6x/PeripheralPins.c, I took a similar approach and updated based on these commits (https://github.com/ARMmbed/mbed-os/commits/mbed-os-6.15.1/targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G474xE/TARGET_NUCLEO_G474RE/PeripheralPins.c). However, this was not required for our code to compile with Mbed 6.15.1.
The above changes were enough to get Mbed 6.15 working on all the boards except for the Motor board, which ran into an assertion related to I2C timing (https://github.com/ARMmbed/mbed-os/blob/mbed-os-6.15.1/targets/TARGET_STM/i2c_api.c#L2001). The problem was related to our system clock configuration. The system_clock.c file we were using was copied from an earlier version of Mbed (https://github.com/ARMmbed/mbed-os/blob/mbed-os-6.3.0/targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G474xx/TARGET_NUCLEO_G474RE/system_clock.c). This file was designed for the Nucleo G474RE board, which uses a 24 MHz external oscillator. This resulted in our system clock being lower than intended, which was also not a "default" clock speed supported by Mbed I2C. I used the latest version of system_clock.c from Mbed (https://github.com/ARMmbed/mbed-os/blob/mbed-os-6.15.1/targets/TARGET_STM/TARGET_STM32G4/TARGET_STM32G474xE/system_clock.c) and modified the SetSysClock_PLL_HSE function to handle our custom board.