ESP32 MODBUS ASCII

For general Flowcode discussion that does not belong in the other sections.
pedrazzi
Posts: 21
http://meble-kuchenne.info.pl
Joined: Sat Feb 20, 2021 7:46 am
Location: ITALY
Has thanked: 3 times
Been thanked: 2 times
Contact:

Re: ESP32 MODBUS ASCII

Post by pedrazzi »

I am building a slave object and to test it I use a MB master SW from PC, I have not tried to use another card in master configuration, but I do not think this is the problem ..
As I have already shown I can simply send a message composed correctly by the terminal, but the slave does not respond.
In addition it does not even enter in RX "CheckForIncoming" ...
Tecnoservice

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 503 times
Been thanked: 686 times

Re: ESP32 MODBUS ASCII

Post by BenR »

Hello,

I've had another look at your program for you, you shouldn't need to use the ChangeBaud command as the properties are configuring the baud rate for you to 9600.

I can't see any other problems other then you are using the digital inputs and these are usually inputs to the modbus slave which are then send out but you seem to be using them the other way and so using coils might make more sense.

Can we see your PC side of the communications to double check that this matches? A screen shot of the software might be good enough to see what's going on.

pedrazzi
Posts: 21
Joined: Sat Feb 20, 2021 7:46 am
Location: ITALY
Has thanked: 3 times
Been thanked: 2 times
Contact:

Re: ESP32 MODBUS ASCII

Post by pedrazzi »

here is the program, practically the same as the example from which I removed the LEDs, and a photo of the message sent to which no response follows.
Attachments
MB_tr.jpg
MB_tr.jpg (64.42 KiB) Viewed 7159 times
MB_ric.jpg
MB_ric.jpg (91.58 KiB) Viewed 7159 times
test_MB_ASCII.fcfx
(12.86 KiB) Downloaded 590 times
Tecnoservice

pedrazzi
Posts: 21
Joined: Sat Feb 20, 2021 7:46 am
Location: ITALY
Has thanked: 3 times
Been thanked: 2 times
Contact:

Re: ESP32 MODBUS ASCII

Post by pedrazzi »

even this has no answer
Attachments
MB_tr_2.jpg
MB_tr_2.jpg (89.87 KiB) Viewed 7159 times
Tecnoservice

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 503 times
Been thanked: 686 times

Re: ESP32 MODBUS ASCII

Post by BenR »

Are you sure it's MODbus ASCII the PC application is using?

The default is usually Modbus RTU and looking at the data it does seem to be RTU.
ModbusType.jpg
ModbusType.jpg (10.11 KiB) Viewed 7157 times

pedrazzi
Posts: 21
Joined: Sat Feb 20, 2021 7:46 am
Location: ITALY
Has thanked: 3 times
Been thanked: 2 times
Contact:

Re: ESP32 MODBUS ASCII

Post by pedrazzi »

unfortunately the request is ASCII, I tried to compile RTU (for test), but the result does not change ..
Tecnoservice

pedrazzi
Posts: 21
Joined: Sat Feb 20, 2021 7:46 am
Location: ITALY
Has thanked: 3 times
Been thanked: 2 times
Contact:

Re: ESP32 MODBUS ASCII

Post by pedrazzi »

the project I attached in the post with the two photos is the one I use (ASCII)
Tecnoservice

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 503 times
Been thanked: 686 times

Re: ESP32 MODBUS ASCII

Post by BenR »

Hello,

Yes sorry I see now you're right it is ASCII mode data.

I have been back through the component and beleive I may have fixed a significant bug in the way ASCII data is sent and received. Fingers crossed that helps your situation and gets it working for you.

pedrazzi
Posts: 21
Joined: Sat Feb 20, 2021 7:46 am
Location: ITALY
Has thanked: 3 times
Been thanked: 2 times
Contact:

Re: ESP32 MODBUS ASCII

Post by pedrazzi »

I added a check on the error in reception "255", but this is also ignored ..
Attachments
test_MB_ASCII.fcfx
(13.5 KiB) Downloaded 668 times
Tecnoservice

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 503 times
Been thanked: 686 times

Re: ESP32 MODBUS ASCII

Post by BenR »

Hello again,

I've done a lot of testing now and found some more problems with the ASCII mode which have hopefully now been resolved for you. It's now working correctly for me with Flowcode as the master and the slave. I've also tried with some third party software to double check I have everything correct and so far these tests have also been very positive.

FIngers crossed and let me know how you get on.

Post Reply