Open ss1k opened 5 months ago
Hi @ss1k,
What kind of board and chip are used in your project? I guess you configured your ports incorrectly, NB_IOT and console use the same port = UART0. The default settings for console is UART0 and this is the port where the modbus and other software send the log messages.
idf.py menuconfig
:
Hi @ss1k,
What kind of board and chip are used in your project? I guess you configured your ports incorrectly, NB_IOT and console use the same port = UART0. The default settings for console is UART0 and this is the port where the modbus and other software send the log messages.
idf.py menuconfig
:
Hi @alisitsyn, I use a self-designed board and the chip is esp32c3, we solder the UART0 and NB_IOT module together, in this case, we can only use UART1 for modbus. The console port is UART0, and we can see the message from NB_IOT side, at the same time, the AT receiving message task of NB_IOT is running, that's why I don't wanna modbus's log message to be sent to UART0. Is there a way to change the UART of modbus? Thanks
Is there a way to change the UART of modbus?
it is possible to change the working port of modbus but it is impossible to change the logging port for modbus. It is also possible to disable some messages of modbus but the component uses the unique tag for each module. I think the better way is to change the logging behavior of the component moving it to your_project/components
folder and redefine the logging macros to some custom redefined versions. In this case you will be able to control the logging of Modbus as you need.
Is there a way to change value of s_port_lock? or what are the other solutions to address my problem?
The s_port_lock
is the log for critical section of modbus port functionality. I don't think you need to change this. You can just redefine the log output macro as you need, the lock functions itself should not output anything into port.
'D (9799) intr_alloc: Connected src 22 to int 9 (cpu 0)[0m
This comes from interrupt allocation module and can be disabled: esp_log_level_set("intr_alloc", ESP_LOG_NONE);
Please also consider to disable the standard logging output functionality in this case and use your UART0 for NB_IOT only:
Is there a way to change the UART of modbus?
it is possible to change the working port of modbus but it is impossible to change the logging port for modbus. It is also possible to disable some messages of modbus but the component uses the unique tag for each module. I think the better way is to change the logging behavior of the component moving it to
your_project/components
folder and redefine the logging macros to some custom redefined versions. In this case you will be able to control the logging of Modbus as you need.Is there a way to change value of s_port_lock? or what are the other solutions to address my problem?
The
s_port_lock
is the log for critical section of modbus port functionality. I don't think you need to change this. You can just redefine the log output macro as you need, the lock functions itself should not output anything into port.'D (9799) intr_alloc: Connected src 22 to int 9 (cpu 0)[0m
This comes from interrupt allocation module and can be disabled: esp_log_level_set("intr_alloc", ESP_LOG_NONE);
Please also consider to disable the standard logging output functionality in this case and use your UART0 for NB_IOT only: "idf.py menuconfig", go to "Bootloader config" and set "Bootloader log verbosity" to "No output" to disable bootloader output "idf.py menuconfig", go to "Component config", "Log output", set "Default log verbosity" to "No output" to disable application output; Would this work for your project or you need some custom logging behavior also? Please let me know if this helps. Thanks.
Thank you so much for your help, we will change the logging behavior and move the modbus component under our project directory, I will let you know how's the result soon!
The project I'm working on right now, uses UART0 for NB-IOT communication, and UART1 for modbus. The problem occurs when setting up modbus, when it enters critical, the modbus's log info will be received by UART0. Following are those wrongly received message.
I tried to assign s_port_lock to 1, since _lock_t is an Interger essentially, but it doesn't work. So I just commented out enter/exit critical and changed ESP_EARLY_LOGD into ESP_LOGD, most of the wrong message can be handled properly, but still
this line of modbus information be received by NB-IOT.
Is there a way to change value of s_port_lock? or what are the other solutions to address my problem?