freemodbus: configure timer handler placement

place timer interrupt handler into flash by default;
add default settings for timer and UART interrupts to place them into IRAM into example defaults;
CONFIG_FMB_TIMER_PORT_ENABLED default = n, when enabled, the UART_ISR_IN_IRAM set to y
This commit is contained in:
Alex Lisitsyn 2019-11-12 22:16:55 +08:00 committed by Ivan Grokhotkov
parent bfe5662387
commit cfdd5f0ef7
5 changed files with 14 additions and 7 deletions

View File

@ -122,14 +122,16 @@ menu "Modbus configuration"
help
Modbus Timer Index in the group that is used for timeout measurement.
config FMB_ISR_IN_IRAM
bool "Place interrupt handlers into IRAM"
default y
config FMB_TIMER_ISR_IN_IRAM
bool "Place timer interrupt handler into IRAM"
default n
select UART_ISR_IN_IRAM
help
This option places Modbus IRQ handlers into IRAM.
This option places Modbus timer IRQ handler into IRAM.
This allows to avoid delays related to processing of non-IRAM-safe interrupts
during a flash write operation (NVS updating a value, or some other
flash API which has to perform an read/write operation and disable CPU cache).
This option has dependency with the UART_ISR_IN_IRAM option which places UART interrupt
handler into IRAM to prevent delays related to processing of UART events.
endmenu

View File

@ -130,8 +130,8 @@ PR_BEGIN_EXTERN_C
/*! \brief If the <em>Read/Write Multiple Registers</em> function should be enabled. */
#define MB_FUNC_READWRITE_HOLDING_ENABLED ( 1 )
/*! \brief Check the option to place handlers into IRAM */
#define MB_ISR_IN_IRAM ( CONFIG_FMB_ISR_IN_IRAM )
/*! \brief Check the option to place timer handler into IRAM */
#define MB_PORT_TIMER_ISR_IN_IRAM ( CONFIG_FMB_TIMER_ISR_IN_IRAM )
/*! @} */
#ifdef __cplusplus

View File

@ -43,7 +43,7 @@ PR_BEGIN_EXTERN_C
#define MB_PORT_SERIAL_ISR_FLAG ESP_INTR_FLAG_LOWMED
#endif
#if MB_ISR_IN_IRAM
#if MB_PORT_TIMER_ISR_IN_IRAM
#define MB_PORT_ISR_ATTR IRAM_ATTR
#define MB_PORT_TIMER_ISR_FLAG ESP_INTR_FLAG_IRAM
#else

View File

@ -4,6 +4,7 @@
CONFIG_FMB_TIMER_PORT_ENABLED=y
CONFIG_FMB_TIMER_GROUP=0
CONFIG_FMB_TIMER_INDEX=0
CONFIG_FMB_TIMER_ISR_IN_IRAM=y
CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200
CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150
CONFIG_MB_UART_RXD=22

View File

@ -4,3 +4,7 @@
CONFIG_MB_UART_RXD=22
CONFIG_MB_UART_TXD=23
CONFIG_MB_UART_RTS=18
CONFIG_FMB_TIMER_PORT_ENABLED=y
CONFIG_FMB_TIMER_GROUP=0
CONFIG_FMB_TIMER_INDEX=0
CONFIG_FMB_TIMER_ISR_IN_IRAM=y