lpcmanager

Parents db87dd969fe2
Children 3209e03c1607
Smarteh 485: uart data is copied to beremiz buffer even if reception was not successfull. This ensures that communication statuses are updated. Otherwise these statuses are not updated in case controller can't communicate with any slave. This bug was introduced in revision 614.
--- a/LPCBus/MC9_Devices_decl.c Wed Jul 19 08:13:37 2017 +0200
+++ b/LPCBus/MC9_Devices_decl.c Thu Jul 20 14:43:14 2017 +0200
@@ -320,22 +320,22 @@
&uartDevWriteBuf[i][0],
uartDev[i][1]);
+ memcpy(uartDevReadBuf_drv, &uartDevReadBuf, sizeof(uartDevReadBuf_t));
+
+ if(!rt_mutex_acquire(&UART_ReadMutex, TM_INFINITE )){
+ if(uartDevReadBuf_plc_state == EMPTY){
+ uartDevReadBuf_t *uartDevReadBuf_tmp;
+ uartDevReadBuf_tmp = uartDevReadBuf_plc;
+ uartDevReadBuf_plc = uartDevReadBuf_drv;
+ uartDevReadBuf_drv = uartDevReadBuf_tmp;
+ uartDevReadBuf_plc_state = FULL;
+ }
+ rt_mutex_release(&UART_ReadMutex);
+ }
+
// Check communication status:
if(commStat == TRUE)
{
- memcpy(uartDevReadBuf_drv, &uartDevReadBuf, sizeof(uartDevReadBuf_t));
-
- if(!rt_mutex_acquire(&UART_ReadMutex, TM_INFINITE )){
- if(uartDevReadBuf_plc_state == EMPTY){
- uartDevReadBuf_t *uartDevReadBuf_tmp;
- uartDevReadBuf_tmp = uartDevReadBuf_plc;
- uartDevReadBuf_plc = uartDevReadBuf_drv;
- uartDevReadBuf_drv = uartDevReadBuf_tmp;
- uartDevReadBuf_plc_state = FULL;
- }
- rt_mutex_release(&UART_ReadMutex);
- }
-
uartCommStatusBuf[i][0] = TRUE;
uartCommErrCntBuf[i][0] = 0;
}