Closed mbq closed 11 months ago
L476RG doesn't have HSI48 nor CRS (needed for sync_from_usb
).
The solution is to use PLL, yes. However HSI is not accurate enough to meet USB specs, you should use HSE with some accurate clock source. (HSI48 with CRS can sync to USB to get accuracy, but the regular HSI can't)
The code tries to use USB-synced HSI48: https://github.com/embassy-rs/embassy/blob/0b015bd727547d1eade5cd12c8b6a1b77483e6db/examples/stm32l4/src/bin/usb_serial.rs#L26
which triggers not-found errors on both
hsi48
field andHsi48Config
struct in HAL, presumably because this board lacks hardware support. I have copied the CubeMX solution, namely to use PLLSAI1_Q, and it seems to work, though I don't know if this is an optimal one: