Mercurial > public > ostc4
diff Small_CPU/Src/uart_Internal.c @ 939:f41974734268 Evo_2_23 tip
Resume UART com with gnss after sleep:
Some changes were needed to get the communication up and running again after the gnns modul was set into power mode. The config needs to be safed at shutdown and the receiver needs to be wake up using dummy bytes before real communication may be resumed
author | Ideenmodellierer |
---|---|
date | Tue, 10 Dec 2024 21:03:04 +0100 |
parents | effadaa3a1f7 |
children |
line wrap: on
line diff
--- a/Small_CPU/Src/uart_Internal.c Tue Dec 10 21:00:55 2024 +0100 +++ b/Small_CPU/Src/uart_Internal.c Tue Dec 10 21:03:04 2024 +0100 @@ -158,7 +158,7 @@ static uint8_t retryRequest = 0; static uint32_t lastRequestTick = 0; static uint32_t TriggerTick = 0; - static uint8_t timeToTrigger = 0; + static uint16_t timeToTrigger = 0; uint32_t tick = HAL_GetTick(); uartGnssStatus_t gnssState = uartGnss_GetState(); @@ -175,6 +175,16 @@ timeToTrigger = 1; retryRequest = 0; } + else if((gnssState == UART_GNSS_INACTIVE) && (!uartGnss_isPowerDownRequested())) /* send dummy bytes to wakeup receiver */ + { + txBufferUart6[0] = 0xFF; + txBufferUart6[1] = 0xFF; + HAL_UART_Transmit_DMA(Uart6Ctrl.pHandle, Uart6Ctrl.pTxBuffer,2); + timeToTrigger = 500; /* receiver needs 500ms for wakeup */ + lastRequestTick = tick; + gnssState = UART_GNSS_PWRUP; + uartGnss_SetState(gnssState); + } else if(((retryRequest == 0) /* timeout or error */ && (((time_elapsed_ms(lastRequestTick,tick) > (TIMEOUT_SENSOR_ANSWER)) && (gnssState != UART_GNSS_IDLE)) /* retry if no answer after half request interval */ || (gnssState == UART_GNSS_ERROR)))) @@ -194,7 +204,7 @@ retryRequest = 0; timeToTrigger = 1; - if((gnssState == UART_GNSS_GET_SAT) || (gnssState == UART_GNSS_GET_PVT)) /* timeout */ + if((gnssState == UART_GNSS_GET_SAT) || (gnssState == UART_GNSS_GET_PVT) || (gnssState == UART_GNSS_PWRUP)) /* timeout */ { gnssState = UART_GNSS_IDLE; uartGnss_SetState(gnssState);