Commit Graph

47 Commits

Author SHA1 Message Date
Alex Lisitsyn eb45711d81 freemodbus: add support for list of area descriptors for each register area
add multi register area descriptors into concrete port (initial)
add create/destroy of area descriptors into concrete port
add  the list of descriptors in common slave interface structure and init/destroy in concrete slave port
move r/w callback functions into common slave
final update of common slave interface wrappers add override API option in concrete port
update slave examples to check new  feature


* Original commit: espressif/esp-idf@96b77a28b1
2022-03-21 13:15:54 +01:00
Fu Hanxi 84c8ac80ea style: format python files with isort and double-quote-string-fixer
* Original commit: espressif/esp-idf@0146f258d7
2022-03-21 13:15:54 +01:00
Marius Vikhammer 4e41405f2b esp32c3: Disable components that are not yet supported
* Original commit: espressif/esp-idf@0301c66bf0
2022-03-21 13:15:54 +01:00
Angus Gratton e0102243f5 Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)


* Original commit: espressif/esp-idf@66fb5a29bb
2022-03-21 13:15:54 +01:00
Alex Lisitsyn fb445432c4 Bugfix/fix RS485 ut fail
* Original commit: espressif/esp-idf@8737584789
2022-03-21 13:15:54 +01:00
Michael (XIAO Xufeng) c123f2895b Revert "ci: temporarily disable RS485 related tests"
This reverts commit 315aeecb73855526df9bb73061bba78630610b25

* Original commit: espressif/esp-idf@4941cf58d0
2022-03-21 13:15:54 +01:00
Marius Vikhammer 42e560e61b docs: add warning for doxygen version
Running with a newer doxygen version than what's
used in CI may raise warnings locally that are not
present when built by CI


* Original commit: espressif/esp-idf@9b552ce004
2022-03-21 13:15:54 +01:00
Alex Lisitsyn bf49bec977 examples: freemodbus add tcp support for common master/slave iface
Add TCP port files to provide Modbus TCP interface for communication
Add freemodbus add tcp support for common master/slave iface and tcp example based on socket API
The communication between master and slave checked for each example serial_master, serial_slave (use ModbusPoll TCP)
update tcp example according netif changes, fix ci issues
update TCP slave implementation
update example_test.py to to set IP through stdin
update API documentation
event bit instead of semahore to lock communication resource
update default options and master/slave port files

Closes https://github.com/espressif/esp-idf/issues/858
Closes IDF-452


* Original commit: espressif/esp-idf@d0b9829eef
2022-03-21 13:15:54 +01:00
Ivan Grokhotkov 837bbe01b4 ci: temporarily disable RS485 related tests
* Original commit: espressif/esp-idf@983220e216
2022-03-21 13:15:54 +01:00
aleks 3e45775f25 freemodbus: fix memcmp result truncated to 1 byte
Coverity ID: 291158


* Original commit: espressif/esp-idf@30e97e0920
2022-03-21 13:15:54 +01:00
Alex Lisitsyn 6fd4511a39 freemodbus: fix fragmented response frame causes next value fail
drop uart ll driver fix: soc: prevent speculative reads from FIFO at -O2 optimization
(new compiler fixes this issue)


* Original commit: espressif/esp-idf@b28b62b194
2022-03-21 13:15:54 +01:00
aleks 7ae0805d65 freemodbus: fix event processing failure after destroy
Closes https://github.com/espressif/esp-idf/issues/5275


* Original commit: espressif/esp-idf@3bbdfb75ad
2022-03-21 13:15:54 +01:00
Alex Lisitsyn 2ce5c0cb95 freemodbus: add extern c block into common header for cpp
* Original commit: espressif/esp-idf@b1fe4c4cc6
2022-03-21 13:15:54 +01:00
Alex Lisitsyn 7cb1e34dd6 freemodbus: fix long buffer failure
check master read write functions with array of registers)
fix master serial processing code and modbus controller to work with register array
modbus_master: add reading and writing of test value array (58 registers) to check failure is gone
remove parameter temporary buffer from modbus controller to allow more than 24 byte writes
driver: fix issue with TOUT feature
driver: fix uart_rx_timeout issue
driver: fix issue with rxfifo_tout_int_raw not triggered when received fifo_len = 120 byte and all bytes read out of fifo as result of rxfifo_full_int_raw
driver: add function uart_internal_set_always_rx_timeout() to always handle tout interrupt
examples: call uart_internal_set_always_rx_timeout() to handle tout interrupt correctly
examples: update examples to use tout feature
driver: reflect changes of uart_set_always_rx_timeout() function, change uart.c
driver: change conditions to trigger workaround for tout feature in uart.c
driver: change uart_set_always_rx_timeout()
freemodbus: fix tabs, remove commented code
driver: remove uart_ll_is_rx_idle()


* Original commit: espressif/esp-idf@3abdd2207d
2022-03-21 13:15:54 +01:00
Alex Lisitsyn 2a4a72101e driver: fix driver set rx timeout feature of uart
tout_thr - move calculation and masking into hal layer update driver and uart_ll (add uart_ll_set_rx_tout)
move tout calculation into uart_ll
move calculation of time out in bit time for esp32s2 into low level uart_ll.h file
move uart_hal_get_symb_len() into hal
update set_rx_timeout() to warn user about incorrect value
update HAL, LL 1
fix uart_xx_set_rx_tout() to convert symbol time into bit time
update param description
update tout calculation in LL
update uart_hal_get_max_rx_timeout_thrd() and uart_ll_get_max_rx_timeout_thrd()


* Original commit: espressif/esp-idf@16e6e63694
2022-03-21 13:15:54 +01:00
Angus Gratton fee5069a2c docs: Resolve doxygen & Sphinx warnings
* Original commit: espressif/esp-idf@11fac8637a
2022-03-21 13:15:54 +01:00
Felipe Neves 149d4cc74f freertos: moved all xtensa specific files into a separated folder
* Original commit: espressif/esp-idf@429712c6eb
2022-03-21 13:15:54 +01:00
Alex Lisitsyn b56073a5cd freemodbus: fix merge issues
* Original commit: espressif/esp-idf@ba1ee4092a
2022-03-21 13:15:54 +01:00
Alex Lisitsyn 8073747198 freemodbus: update poll event processing
update modbus poll event loop processing to process multiple events


* Original commit: espressif/esp-idf@44444208b7
2022-03-21 13:15:54 +01:00
He Yin Ling 160d99ff15 test: update example and unit tests with new import roles:
tiny_test_fw is a python package now. import it using normal way.


* Original commit: espressif/esp-idf@c906e2afee
2022-03-21 13:15:54 +01:00
aleks 82f7fe4d35 freemodbus: fix merge issues
* Original commit: espressif/esp-idf@6e14b6265b
2022-03-21 13:15:54 +01:00
aleks 73bbc0cd7d freemodbus: fix clang warnings
* Original commit: espressif/esp-idf@cf4c95532f
2022-03-21 13:15:54 +01:00
houwenxiang ae990b6ca3 feature: Add uart hal support.
* Original commit: espressif/esp-idf@f27ae9b0e2
2022-03-21 13:15:54 +01:00
aleks f2b8b3c238 freemodbus: fix supported targets ci issue
* Original commit: espressif/esp-idf@4f9742d90c
2022-03-21 13:15:54 +01:00
Alex Lisitsyn 9f6f956db8 freemodbus: add modbus master ascii
add support of modbus master ascii
rename base dir name of master and slave example to be mb_slave, mb_master to avoid conflict with sdio/slave example test
add Kconfig option to enable ASCII and RTU mode separately
update ASCII options + remove cast for errors
added baudrate for examples into Kconfig
updated magic numbers for timer timeout
put ascii private definitions into one file


* Original commit: espressif/esp-idf@67f62a79c1
2022-03-21 13:15:54 +01:00
Alex Lisitsyn 236d1dcfa4 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


* Original commit: espressif/esp-idf@cfdd5f0ef7
2022-03-21 13:15:06 +01:00
Alex Lisitsyn 64eb1b79e8 freemodbus: fix nvs access failure
place timer handler functions into IRAM
update timer port handlers
fix communication issues
fix offset issue in example
add kconfig option to place handlers into IRAM


* Original commit: espressif/esp-idf@1ab9e81729
2022-03-21 13:15:06 +01:00
Alex Lisitsyn 8529961413 freemodbus: fix a bug with destroy function of modbus controller and fix port destroy functions
adds timer interrupt handle and free it in vMBXXXPortTimerClose() in master and slave timer port
assign modbus controller interface pointer to NULL in destroy function after free


* Original commit: espressif/esp-idf@4bac558ab3
2022-03-21 13:15:06 +01:00
Michael (XIAO Xufeng) 3062909951 timer_group: use the LL
* Original commit: espressif/esp-idf@264ffbeb14
2022-03-21 13:15:02 +01:00
Anton Maklakov 682645419b tools: Mass fixing of empty prototypes (for -Wstrict-prototypes)
* Original commit: espressif/esp-idf@afbaf74007
2022-03-21 13:14:00 +01:00
Renz Christian Bagaporo f7c40d1b11 cmake: some formatting fixes
Do not include bootloader in flash target when secure boot is enabled.
Emit signing warning on all cases where signed apps are enabled (secure
boot and signed images)
Follow convention of capital letters for SECURE_BOOT_SIGNING_KEY
variable, since it is
relevant to other components, not just bootloader.
Pass signing key and verification key via config, not requiring
bootloader to know parent app dir.
Misc. variables name corrections


* Original commit: espressif/esp-idf@9b350f9ecc
2022-03-21 13:14:00 +01:00
Renz Christian Bagaporo b8781516c1 components: use new component registration api
* Original commit: espressif/esp-idf@9eccd7c082
2022-03-21 13:14:00 +01:00
chenjianqiang 0e98d546ec feat(uart): update uart driver for esp32s2beta
* Original commit: espressif/esp-idf@4cc962353c
2022-03-21 13:13:26 +01:00
suda-morris 365bddd919 build and link hello-world for esp32s2beta
* Original commit: espressif/esp-idf@84b2f9f14d
2022-03-21 13:13:26 +01:00
Konstantin Kondrashov 4b8c30f606 all: Using xxx_periph.h
Using xxx_periph.h in whole IDF instead of xxx_reg.h, xxx_struct.h, xxx_channel.h ... .

Cleaned up header files from unnecessary headers (releated to soc/... headers).


* Original commit: espressif/esp-idf@399d2d2605
2022-03-21 13:13:26 +01:00
Roland Dobai 786ade0c0d Rename Kconfig options (components/freemodbus)
* Original commit: espressif/esp-idf@976d2a4b7f
2022-03-21 13:13:26 +01:00
Renz Christian Bagaporo 3082ecdf6a components: update with build system changes
* Original commit: espressif/esp-idf@ffec9d4947
2022-03-21 13:13:26 +01:00
Alex Lisitsyn e039ae7acc freemodbus: Fix bug with incorrect coils read mask
Contains two different component folders per each implementation (serial_master and serial_slave) with concrete ports.
Added common public api for master and slave and common interface for master and slave implementation.
Add support of cmake system (added cmake files).
Added sdkconfig.defaults files for slave and master modbus examples.
Updated make file and KConfig for freemodbus component
Update according to review and fix doxygen warnings
Fix Doxyfile to pass documentation build
Update headers and change interface file names as per review comments
Merge  branch feature/freemodbus_move_rs485_mode_control
Update after review:
The stack modbus folder updated to support master and slave ports together and moved into freemodbus/modbus
Stack and port files updated to remove duplicated simbols
Make file, KConfig and CMakeLists.txt updated to compile master and slave stacks, common interface and concrete implementations of ports
Stack callback functions execute callbacks using interface pointer from concrete port implementation
User can instantiate any of concrete port using common API (only one concrete port at a time) and it does not require to select port by KConfig
Port pins and mode configuration moved into example files from port files to allow user select pins and port mode (customer request)
Changes tested using pymodbus, ModbusPoll and communication between two boards
Updated DoxyFile according to public include path
Fix maximum instance size for slave (merge from master of customer issue)
Fix critical section issue TW#28622 (change spin lock based critical section to semaphore)
Move serial port files into component port folder for master and slave accordingly
Fix example issue showed in the log when IO slave is not configured correctly
Fix conflicts while merging from origin/master
Fix errors handling in modbus controller interface + some final corrections according to review
Update maximum allowed number of slaves in the network segment
Fix bug with incorrect coils read mask

Closes https://github.com/espressif/esp-idf/issues/858


* Original commit: espressif/esp-idf@449d2a6367
2022-03-21 13:13:26 +01:00
aleks d9fae5d0ad freemodbus: fix incorrectly set coils read event
incorrect set of the MB_EVENT_COILS_WR event is changed while read coils in mbcontroller.c file
added read/write handling for appropriate registers in freemodbus.c example file

Closes https://github.com/espressif/esp-idf/issues/3289


* Original commit: espressif/esp-idf@eebbced5b6
2022-03-21 13:13:26 +01:00
aleks ce241e3ebd freemodbus: change critical sections to semaphore mutex
revert changes made in mbrtu.c, mbascii.c
change critical section type to semaphore mutex instead of spin lock

Closes: https://github.com/espressif/esp-idf/issues/3009


* Original commit: espressif/esp-idf@aaa1cb6eec
2022-03-21 13:13:26 +01:00
Konstantin Kondrashov a3fc6eb571 freemodbus: Fix remove critical_sections
Closes: https://github.com/espressif/esp-idf/issues/3009


* Original commit: espressif/esp-idf@1ef7d093e1
2022-03-21 13:13:26 +01:00
Roland Dobai 3e2a03d032 Correct Kconfigs according to the coding style
* Original commit: espressif/esp-idf@37126d3451
2022-03-21 13:13:26 +01:00
aleks 56838197f5 examples: change max register area size to maximum value
esp-idf/components/freemodbus/modbus_controller/modbus_controller.c: The MB_INST_MAX_SIZE is changed to max value=(65535*2);
Update support for coils read into freemodbus.c;

TW#28143
Closes https://github.com/espressif/esp-idf/issues/2884


* Original commit: espressif/esp-idf@e3a786f2cf
2022-03-21 13:13:26 +01:00
aleks 60286c82d3 examples: freemodbus port serial slave move uart mode settings into example
Update freemodbus component file esp-idf/components/freemodbus/port/portserial.c to remove UART mode settings;
Move UART mode settings into esp-idf/examples/protocols/modbus_slave/main/freemodbus.c
Move UART pin settings from Component config into example Kconfig.projbuild file
Move setup of UART port pins from freemodbus component into example file

TW#27721
Closes https://github.com/espressif/esp-idf/issues/2784#issuecomment-443600157


* Original commit: espressif/esp-idf@5379c941b8
2022-03-21 13:13:26 +01:00
Anton Maklakov 5f40771c1e modbus: Fix a typo in the docs
* Original commit: espressif/esp-idf@9dde91ce2b
2022-03-21 13:13:26 +01:00
Alex Lisitsyn a3ff5b55c9 examples: freemodbus port slave basic implementation
This example adds functionality to support basic communication in RS485 networks using Modbus protocol.
This example uses FreeModbus stack and regular UART driver API to communicate in RS485 half duplex mode.
Added initial support of modbus controller pure C api to access device parameters over Modbus transport.
Move freemodbus stack and port files into components folder
Move the modbus_controller interface into components idf folder
Source files updated after review.
Add modbus interface documentation docs/en/api-reference/protocols/modbus.rst
porttimer.c: fix bug with timer1 selected in the Kconfig
Add support of cmake system (added cmake files)

Closes https://github.com/espressif/esp-idf/issues/858


* Original commit: espressif/esp-idf@f0eb9985b9
2022-03-21 13:07:11 +01:00
Alex Lisitsyn eacef70af8 root commit 2021-11-11 09:15:06 +01:00