Mercurial > public > ostc4
comparison Small_CPU/Src/uartProtocol_GNSS.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 | 3029f0332f4f |
children |
comparison
equal
deleted
inserted
replaced
938:df87dbfc9c21 | 939:f41974734268 |
---|---|
64 | 64 |
65 void uartGnss_ReqPowerDown(uint8_t request) | 65 void uartGnss_ReqPowerDown(uint8_t request) |
66 { | 66 { |
67 if(GnssConnected) | 67 if(GnssConnected) |
68 { | 68 { |
69 ReqPowerDown = 1; | 69 ReqPowerDown = request; |
70 } | 70 } |
71 } | |
72 | |
73 uint8_t uartGnss_isPowerDownRequested() | |
74 { | |
75 return ReqPowerDown; | |
71 } | 76 } |
72 | 77 |
73 uartGnssStatus_t uartGnss_GetState() | 78 uartGnssStatus_t uartGnss_GetState() |
74 { | 79 { |
75 return gnssState; | 80 return gnssState; |
92 case GNSSCMD_LOADCONF_1: pData = setNMEA410; | 97 case GNSSCMD_LOADCONF_1: pData = setNMEA410; |
93 txLength = sizeof(setNMEA410) / sizeof(uint8_t); | 98 txLength = sizeof(setNMEA410) / sizeof(uint8_t); |
94 break; | 99 break; |
95 case GNSSCMD_LOADCONF_2: pData = setGNSS; | 100 case GNSSCMD_LOADCONF_2: pData = setGNSS; |
96 txLength = sizeof(setGNSS) / sizeof(uint8_t); | 101 txLength = sizeof(setGNSS) / sizeof(uint8_t); |
102 break; | |
103 case GNSSCMD_SETMOBILE: pData = setPortableMode; | |
104 txLength = sizeof(setPortableMode) / sizeof(uint8_t); | |
97 break; | 105 break; |
98 case GNSSCMD_GET_PVT_DATA: pData = getPVTData; | 106 case GNSSCMD_GET_PVT_DATA: pData = getPVTData; |
99 txLength = sizeof(getPVTData) / sizeof(uint8_t); | 107 txLength = sizeof(getPVTData) / sizeof(uint8_t); |
100 break; | 108 break; |
101 case GNSSCMD_GET_NAV_DATA: pData = getNavigatorData; | 109 case GNSSCMD_GET_NAV_DATA: pData = getNavigatorData; |
155 rxState = GNSSRX_DETECT_ACK_0; | 163 rxState = GNSSRX_DETECT_ACK_0; |
156 break; | 164 break; |
157 case UART_GNSS_LOADCONF_2: UART_Gnss_SendCmd(GNSSCMD_LOADCONF_2); | 165 case UART_GNSS_LOADCONF_2: UART_Gnss_SendCmd(GNSSCMD_LOADCONF_2); |
158 rxState = GNSSRX_DETECT_ACK_0; | 166 rxState = GNSSRX_DETECT_ACK_0; |
159 break; | 167 break; |
168 case UART_GNSS_SETMODE_MOBILE: UART_Gnss_SendCmd(GNSSCMD_LOADCONF_2); | |
169 rxState = GNSSRX_DETECT_ACK_0; | |
170 break; | |
160 case UART_GNSS_PWRDOWN: UART_Gnss_SendCmd(GNSSCMD_MODE_PWS); | 171 case UART_GNSS_PWRDOWN: UART_Gnss_SendCmd(GNSSCMD_MODE_PWS); |
161 rxState = GNSSRX_DETECT_ACK_0; | 172 rxState = GNSSRX_DETECT_ACK_0; |
162 break; | 173 break; |
163 | 174 |
164 case UART_GNSS_PWRUP: | 175 case UART_GNSS_PWRUP: UART_Gnss_SendCmd(GNSSCMD_MODE_NORMAL); |
165 case UART_GNSS_INACTIVE: UART_Gnss_SendCmd(GNSSCMD_MODE_NORMAL); | |
166 rxState = GNSSRX_DETECT_ACK_0; | 176 rxState = GNSSRX_DETECT_ACK_0; |
167 gnssState = UART_GNSS_PWRUP; | 177 gnssState = UART_GNSS_PWRUP; |
168 break; | 178 break; |
169 case UART_GNSS_SETCONF: UART_Gnss_SendCmd(GNSSCMD_SET_CONFIG); | 179 case UART_GNSS_SETCONF: UART_Gnss_SendCmd(GNSSCMD_SET_CONFIG); |
170 rxState = GNSSRX_DETECT_ACK_0; | 180 rxState = GNSSRX_DETECT_ACK_0; |
262 } | 272 } |
263 break; | 273 break; |
264 case GNSSRX_DETECT_ACK_3: if((data == 0x01)) | 274 case GNSSRX_DETECT_ACK_3: if((data == 0x01)) |
265 { | 275 { |
266 rxState = GNSSRX_READY; | 276 rxState = GNSSRX_READY; |
267 if(gnssState == UART_GNSS_PWRUP) | 277 switch(gnssState) |
268 { | 278 { |
269 gnssState = UART_GNSS_IDLE; | 279 case UART_GNSS_PWRUP: gnssState = UART_GNSS_IDLE; |
270 } | 280 break; |
271 else if(gnssState == UART_GNSS_PWRDOWN) | 281 case UART_GNSS_PWRDOWN: rxState = GNSSRX_DETECT_ACK_0; |
272 { | 282 UART_Gnss_SendCmd(GNSSCMD_SET_CONFIG); |
273 rxState = GNSSRX_DETECT_ACK_0; | 283 gnssState = UART_GNSS_SETCONF; |
274 UART_Gnss_SendCmd(GNSSCMD_SET_CONFIG); | 284 break; |
275 gnssState = UART_GNSS_SETCONF; | 285 case UART_GNSS_SETCONF: gnssState = UART_GNSS_INACTIVE; |
276 } | 286 break; |
277 else if(gnssState == UART_GNSS_SETCONF) | 287 case UART_GNSS_LOADCONF_0: |
278 { | 288 case UART_GNSS_LOADCONF_1: gnssState++; |
279 gnssState = UART_GNSS_INACTIVE; | 289 break; |
280 } | 290 case UART_GNSS_LOADCONF_2: gnssState = UART_GNSS_SETMODE_MOBILE; |
281 else if((gnssState >= UART_GNSS_LOADCONF_0) && (gnssState <= UART_GNSS_LOADCONF_2)) | 291 break; |
282 { | 292 case UART_GNSS_SETMODE_MOBILE: gnssState = UART_GNSS_IDLE; |
283 if(gnssState == UART_GNSS_LOADCONF_2) | 293 break; |
284 { | 294 default: |
285 gnssState = UART_GNSS_IDLE; | 295 break; |
286 } | |
287 else | |
288 { | |
289 gnssState++; | |
290 } | |
291 } | 296 } |
292 GnssConnected = 1; | 297 GnssConnected = 1; |
293 } | 298 } |
294 else | 299 else |
295 { | 300 { |