-
Notifications
You must be signed in to change notification settings - Fork 3k
[STM32F3]: fix for uart baudrate. #2099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -69,8 +70,12 @@ static void init_uart(serial_t *obj) | |||
// Disable the reception overrun detection | |||
UartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_RXOVERRUNDISABLE_INIT; | |||
UartHandle.AdvancedInit.OverrunDisable = UART_ADVFEATURE_OVERRUN_DISABLE; | |||
|
|||
HAL_UART_Init(&UartHandle); | |||
/* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misaligned comment. Did you consider doing this as part of the HAL init mbed_sdk_init(), I assume this might be required for more than just UART.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fixing this locally, will merge it manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are tabs, please use spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Arm , or uARM :SystemInit is called after boot (SystemInit write SystemCoreClock and call HAL_Init), then __main is called, this will perform zero initialized of bss , recopy of initialized variable (this will change the value of SystemCoreClock), then _initio calls init_serial (which calls init_uart, init_uart works properly if SystemCoreClock is correctly sets)
Later before calling main , mbed_sdk_init is called, this will update again SystemCoreClock and do again HAL_Init) which will allow a correct usage of UART or other peripheral with HAL.
On GCC_ARM, as zero initialized of bss , recopy of initialized variable is done early after reset and before SystemInit, the value of SystemCoreClock remains un-changed after SystemInit, so with GCC_ARM no need to add this fix in init_uart or in mbed_sdk_init.
On IAR , SystemInit is called after boot (SystemInit write SystemCoreClock and call HAL_Init), then __iar_program_start, this calls __iar_data_init3 which does zero initialized of bss, recopy of initialized data (this will change the value of SystemCoreClock), then mbed_sdk_init is called (This will put the value of systemCoreClock to the correct value) and the init_uart is called at the 1st printf . On IAR the fix in init_uart is not needed.
=> The Init is different according to compilers , this leads to un-confortable fix on ARM and IAR, due the late zero initiliazed, or recopy of initialized data for ARM, IAR compiler.
Integrated on master (removed tabs) |
…..3c7d50e 3c7d50e Remove test files d5f5bee Merge branch 'release_internal' into release_external 72b065b Merge pull request ARMmbed#2133 from ARMmbed/few_updates 1da0b9f Fix unittest cleanup d173249 Adjust GC cleanup threshold and traces 26166d1 Remove ns_sw_mac_packet_ingress_rate_limit_by_mem (ARMmbed#2132) 5305754 Merge pull request ARMmbed#2130 from ARMmbed/IOTTHD-3419 038bc2e Copy ingress rate limiting API to ns_conf 940b516 Fix compiler warnings 64e6ff3 Review corrections 01e7d84 Update GC thresholds, init and traces 1acd1cc Add unit tests for monitor 64c969e Nanostack heap garbage collection d3330b2 Fix errors found by Coverity (ARMmbed#2131) da5d2c7 MAC, RPL and ETX trace clean. eaf8907 Limit amount of incoming packet based on memory (ARMmbed#2128) 0c2b383 Fixed unitest header size compare value for support brodacst shedule. 6c70262 Wi-sun LLC update 7c57343 WS PAN Config handler update 161421b Wi-sun PAN_VERSION lifetime and timeout update 43083ed Fixed broken wi-sun neigbour black list filtering. 0992ee2 Update Pan information data from all selected parent. cafc142 Fixed Pan advertisment route cost comapre for consistent and incosistent db81d02 SW MAC timestamp read update eddf91b Wi-sun neighbor generate limitation 4d6abb3 Added 15 second guarantee time for packet handler before remove link. 9ed97eb SW MAC new API for read current timestamp 6a44829 Stop advertisment RPL prefix if we not have a address and it is not 'A-flag' d37ce6a Revert "Wi-sun dublicate MPX ID filter support" d80ebf8 Fix debug trace format. b1ef0f6 Removed Address reg pending and rady mask from address. ce672ba Added trace for debugging DHCPv6 failure reason. aaf2b39 Wi-sun dublicate MPX ID filter support bd51f9f Merge pull request ARMmbed#2117 from ARMmbed/IOTTHD-3587 b016d52 Fixed DHCPv6 client delete when address was removed to new network discovery. 69fb24b Wi-sun address registration and RPL update 92d3a92 RPL: trace new preferred parent 9a6e4e0 disable multicast NS for wisun 6e13d81 Merge pull request ARMmbed#2113 from ARMmbed/IOTTHD-3577 85aaae7 Refactored the Wi-SUN BBR logic according to design 61f6f5b WS: Added ws stats empty functions ac191c3 Removed link local address verifycation and dead code. 77076d1 Negative ARO timeout use same timeout than not trusted device. c4e8735 Wi-sun DHCP solicit max to 15min from 60min. 66615e6 Updated wi-sun BBR min hop rank increase to 196. 9ce41f1 Pendig address registration will move DAO send. f54ea6b Merge pull request ARMmbed#2110 from ARMmbed/IOTTHD-3577 18dbac2 WS: Implemented ws statistics 3ce95fa FHSS WS: Fixed drift compensation stats b878bd9 KMP address update 7f18afe PAE controller and NVM update f692eb8 Wi-SUN border router configure update 386e5ff Wi-sun Update 05b1fe8 do not send periodic DIO messages if DAO registration is not done 6acee47 modified RSL calculation and value in messaging ee7f218 Modify discovery start timing 1ba806d Wi-SUN NUD send fix 31fb8cd Moved counter config to config.h cf18063 Added storing of MAC frame counter to NVM 68adb36 Neighbor cache update 8cdd961 Added possibility for Update DHCPv6 client server address. 2dfa536 Merge pull request ARMmbed#2099 from ARMmbed/IOTTHD-3231 8dc200b FHSS: Created statistics for WS 5e67f7c RPL update bbae493 wi-sun RPL param update e8567d7 MAC neighbour remove and add trace simplify. 8bb4ab5 Cleaned unnessary debug trace. 3608153 DIO prefix handler update 332735b Disabled Version number periodic update if Dodag max rank inrease is not 0. 940de0b Wi-SUN setup update: c1a89e5 Merge pull request ARMmbed#2095 from ARMmbed/IOTTHD-3474 f6d81b5 Review corrections 7487ca1 Fix clang-6.0 build error and warnings cce3fc7 Security protocols are no longer started second time on authenticator git-subtree-dir: features/nanostack/sal-stack-nanostack git-subtree-split: 3c7d50e
With ARM compiler (i.e) uart is initialized after bss, and sdata and before the call to mbed_sdk_init
For correct uart behaviour, SystemCoreClock must be updated.