Mercurial > public > ostc4
comparison Discovery/Src/ostc.c @ 1046:1d7c7a36df15 GasConsumption
Bugfix OSTC5 BT and enabling fast mode:
The OSTC5 BT was operating at default speed of 115200. To enable the faster communication some init steps have been added to set speed to 460800. Having the UART enabled while the module was shut down caused problems during initialisation. To avoid these the BT UART is now initialized after the the module is powered on and deinitialized while the module is switched off.
| author | Ideenmodellierer |
|---|---|
| date | Fri, 14 Nov 2025 18:54:20 +0100 |
| parents | 5865f0aeb438 |
| children |
comparison
equal
deleted
inserted
replaced
| 1045:b018e1f3082e | 1046:1d7c7a36df15 |
|---|---|
| 155 DISPLAY_RESETB_GPIO_ENABLE(); | 155 DISPLAY_RESETB_GPIO_ENABLE(); |
| 156 EXTFLASH_CSB_GPIO_ENABLE(); | 156 EXTFLASH_CSB_GPIO_ENABLE(); |
| 157 SMALLCPU_CSB_GPIO_ENABLE(); | 157 SMALLCPU_CSB_GPIO_ENABLE(); |
| 158 OSCILLOSCOPE_GPIO_ENABLE(); | 158 OSCILLOSCOPE_GPIO_ENABLE(); |
| 159 OSCILLOSCOPE2_GPIO_ENABLE(); | 159 OSCILLOSCOPE2_GPIO_ENABLE(); |
| 160 BLE_UBLOX_DSR_GPIO_ENABLE(); | 160 if(isNewDisplay()) |
| 161 { | |
| 162 BLE_UBLOX_DSR_GPIO_ENABLE(); | |
| 163 } | |
| 161 | 164 |
| 162 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | 165 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
| 163 GPIO_InitStruct.Pull = GPIO_PULLUP; | 166 GPIO_InitStruct.Pull = GPIO_PULLUP; |
| 164 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | 167 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; |
| 165 | 168 |
| 249 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | 252 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; |
| 250 GPIO_InitStruct.Pin = BLE_NENABLE_PIN; | 253 GPIO_InitStruct.Pin = BLE_NENABLE_PIN; |
| 251 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct); | 254 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct); |
| 252 HAL_GPIO_WritePin(BLE_NENABLE_GPIO_PORT,BLE_NENABLE_PIN,GPIO_PIN_RESET); | 255 HAL_GPIO_WritePin(BLE_NENABLE_GPIO_PORT,BLE_NENABLE_PIN,GPIO_PIN_RESET); |
| 253 | 256 |
| 254 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | 257 if(isNewDisplay()) |
| 255 GPIO_InitStruct.Pull = GPIO_PULLDOWN; | 258 { |
| 256 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | 259 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
| 257 GPIO_InitStruct.Pin = BLE_UBLOX_DSR_PIN; | 260 GPIO_InitStruct.Pull = GPIO_PULLDOWN; |
| 258 HAL_GPIO_Init(BLE_UBLOX_DSR_GPIO_PORT, &GPIO_InitStruct); | 261 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; |
| 259 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET); | 262 GPIO_InitStruct.Pin = BLE_UBLOX_DSR_PIN; |
| 263 HAL_GPIO_Init(BLE_UBLOX_DSR_GPIO_PORT, &GPIO_InitStruct); | |
| 264 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET); | |
| 265 } | |
| 260 } | 266 } |
| 261 | 267 |
| 262 | 268 |
| 263 void MX_Bluetooth_PowerOff(void) | 269 void MX_Bluetooth_PowerOff(void) |
| 264 { | 270 { |
| 265 GPIO_InitTypeDef GPIO_InitStruct; | 271 GPIO_InitTypeDef GPIO_InitStruct; |
| 266 GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | 272 GPIO_InitStruct.Mode = GPIO_MODE_INPUT; |
| 267 GPIO_InitStruct.Pin = BLE_NENABLE_PIN; | 273 GPIO_InitStruct.Pin = BLE_NENABLE_PIN; |
| 268 GPIO_InitStruct.Pull = GPIO_NOPULL; | 274 GPIO_InitStruct.Pull = GPIO_NOPULL; |
| 269 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct); | 275 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct); |
| 270 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET); | 276 |
| 277 if(isNewDisplay()) | |
| 278 { | |
| 279 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET); | |
| 280 } | |
| 271 } | 281 } |
| 272 | 282 |
| 273 | 283 |
| 274 void MX_SmallCPU_Reset_To_Boot(void) | 284 void MX_SmallCPU_Reset_To_Boot(void) |
| 275 { | 285 { |
| 370 UartHandle.Init.BaudRate = 115200; | 380 UartHandle.Init.BaudRate = 115200; |
| 371 UartHandle.Init.WordLength = UART_WORDLENGTH_8B; | 381 UartHandle.Init.WordLength = UART_WORDLENGTH_8B; |
| 372 UartHandle.Init.StopBits = UART_STOPBITS_1; | 382 UartHandle.Init.StopBits = UART_STOPBITS_1; |
| 373 UartHandle.Init.Parity = UART_PARITY_NONE; | 383 UartHandle.Init.Parity = UART_PARITY_NONE; |
| 374 UartHandle.Init.Mode = UART_MODE_TX_RX; | 384 UartHandle.Init.Mode = UART_MODE_TX_RX; |
| 375 HAL_UART_Init(&UartHandle); | 385 /* HAL_UART_Init(&UartHandle); moved final init step into BT config function to avoid problems while module power is off */ |
| 376 | 386 |
| 377 #ifdef USART_PIEZO | 387 #ifdef USART_PIEZO |
| 378 UartPiezoTxHandle.Instance = USART_PIEZO; | 388 UartPiezoTxHandle.Instance = USART_PIEZO; |
| 379 UartPiezoTxHandle.Init.BaudRate = 1200; | 389 UartPiezoTxHandle.Init.BaudRate = 1200; |
| 380 UartPiezoTxHandle.Init.WordLength = UART_WORDLENGTH_8B; | 390 UartPiezoTxHandle.Init.WordLength = UART_WORDLENGTH_8B; |
