Skip to content

Commit 56dce6c

Browse files
committed
Corrected critical section usage and prepared next release.
1 parent afbac8b commit 56dce6c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
-----------------------------------------------------------------------------------------
2+
2024-02-04 Frank Voorburg <[email protected]>
3+
4+
* Corrected critical section usage in combination with OSAL API calls.
5+
* Public release of version 0.9.3.
6+
7+
-----------------------------------------------------------------------------------------
8+
-----------------------------------------------------------------------------------------
29
2024-01-14 Frank Voorburg <[email protected]>
310

411
* Changed the default configuration of the 1.5 character timeout monitoring.

source/microtbxmodbus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extern "C" {
5858
#define TBX_MB_VERSION_MINOR (9U)
5959

6060
/** \brief Patch number of MicroTBX-Modbus. */
61-
#define TBX_MB_VERSION_PATCH (2U)
61+
#define TBX_MB_VERSION_PATCH (3U)
6262

6363

6464
#ifdef __cplusplus

source/tbxmb_rtu.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,16 @@ static uint8_t TbxMbRtuTransmit(tTbxMbTp transport)
525525
*/
526526
uint16_t waitTimeoutMs = (waitTimeoutTicks + 19U) / 20U;
527527
/* Wait for the transition from INIT to IDLE with the calculated timeout. Note
528-
* that there is not need to check the return value. This would just mean that
529-
* no transition to IDLE took place before the timeout. The IDLE state check if
528+
* that there is no need to check the return value. This would just mean that
529+
* no transition to IDLE took place before the timeout. The IDLE state check is
530530
* done later on in this function, so that error situation is already handled.
531+
* Make sure to briefly leave the critical section for calling TbxMbOsalSemTake().
532+
* With an RTOS this could lead to a context switch for which interrupts need to
533+
* be enabled.
531534
*/
535+
TbxCriticalSectionExit();
532536
(void)TbxMbOsalSemTake(tpCtx->initStateExitSem, waitTimeoutMs);
537+
TbxCriticalSectionEnter();
533538
}
534539
/* New transmissions are only possible from the IDLE state. */
535540
uint8_t okayToTransmit = TBX_FALSE;

0 commit comments

Comments
 (0)