I’m trying to revive MBed6 support for RAK811 in a custom board target.
I’m writing this post for two reasons:
- in the hopes that someone with more knowledge may give me some guidance in how to get the module working again
- hoping it may help anyone else that needs to get a STM32 chip working.
Progress to date:
Generating Mbed HAL STM32 chip specific code:
- I’ve discovered that the STM32 custom targets repo (@jeromecoutant mentioned to me in another thread) doesn’t have support for the RAK811, or the STM32L151CB chip it is based on.
- The make_generic_boards.py script fails as it can’t download the correct file from STM32 open pin data repo
- That repo is a subset of files that have been open sourced from STCubeMX, so I found the correct file in my local installation (This could mean licensing is an issue preventing me from sharing the remainder of my work - or even using the file? I haven’t yet found a licensing statement anywhere clearly covering the specific files, so I’ll have to re-read the EULA I guess, and that seems likely to reserve all rights just to be safe. I guess it’s only copyright, so I can manually recreate the file without infringing that if this process works…)
- I’ve symlinked the correct dir from the STMCubeMX , manually run the STM32_gen_PeripheralPins.py script with -n, modified the make_generic_boards.py script to skip calling the STM32_PeripheralPins.py (just use the already generated directories and files), and successfully generated PinNames.h, PeripheralPins.c and an almost empty system_clock.c
- I’ve modified the STM32[L1] Mbed HAL code to compile: I’ve configured MST timer to use TIM4 as TIM5 isn’t available (and then discovered that TIM4 may be in use for LPTicker by the look of it, though I want it to use the RTC - work left to do to confirm config here ensure not conflicting)
- I’ve accounted for expected peripherals that are missing on this chip: SPI3 is now contingent on UART3_BASE being defined, ditto PWM5 and TIM 5
- I’ve modified RTC to only use SSR if the chip is not defined as STM32L1_CAT1 (as they are value devices without the SSR)
The code now compiles, but is not yet tested.
I haven’t yet investigated how to get TICKLESS support or how to make the LPTicker use the RTC. I suspect there could be more gotchas identified when resolving those two, or not even thought of yet.
If anyone knows what else may need addressing, suggestions would be appreciated!
@jeromecoutant I notice that you are very active in the stm32customtargets repo, so I was hoping you may be able to comment on:
- why the STM32L151xB boards are not part of stm32 open pin data, or if there is any hope that it could be made available?
- Will the licensing prevent me sharing the target if/when it’s complete? Can anything be done about that?
- I’ll need to make minor mods to the stm32 code in mbed to remove the dependency on inaccessible peripherals in the mbed repo. in partnership with the custom target (the generic driver code assumes TIM5, SPI3 and RTC->SSR exist, but they don’t on this chip). What’s the best way to deal with that?
I’d upload all this code to my own git repo, but I don’t want to start sharing copyright protected files.
I’ll post progress updates when they are made, but it’s a low priority hobby project for now so it may be a few days before the next update.