MODBUS RTU implementation on PK S5D9

Hi all,

I'm  facing issue with porting modbus library into renesas platform .

I have seen post on forum but found not so useful .

Appreciate if someone can share their experience working with rs485 terminal of  S5D9.

Many Thanks

  • In reply to Kirti:

    1) As per the modpoll documentation, -r start reference

    2) modpoll sends function code 16 (write multiple holding registers) even if only 1 write value is given to modpoll

  • In reply to Jeremy:

    for single write register ,I sent command as -m rtu -a 10 -r 1 -t 4  -b 9600 -d 8 -p even COM4  6 so this function eBFuncWriteHoldingRegister is expected to execute but eMBFuncWriteMultipleHoldingRegister exception gets executed. I sending wrong command for single write register ? what value the reference is updated because in modpoll command there is no value specified by which the refrence should be updated (it just send function code but no new value/data) like how we do in modscan software.



  • In reply to Kirti:

    As per the modpoll documentation :-


    -r is the start reference (red arrow) the write value is the blue arrow.


    Modpoll seems to always send write multpile holding register command

  • In reply to Jeremy:

    Please correct my understanding if wrong holding register command: -m rtu -a 10 -r 1  -c10 -t 4  -b 9600 -d 8 -p even COM4 (reading references starting  from 1 to 10 )

    2.write holding register : -m rtu -a 10 -r 2  -t 4  -b 9600 -d 8 -p even COM4 160(write refreence 2 by value 160)

    so in only one debug session I tried following points 

    1.By sending command mentioned in point 2 I wrote reference 2 by 160 got written(1 reference written) so to check its really got written  I sent read command in same debug session as mentioned in point 1 so that references from 1 to 10 can be read with reference 2 updated by 160 but modpoll shows respose as below

    does modpoll write only one reference at a time ?

    In one debug session ,not getting response for all the command,timeout error received.(requires some delay or need to reduce timer count)

    Will freemodbus work with modscan64 tool(doesnot require command, requires to select slaveid, baudrate,function code ,com port,mode available from drop down option) ?-It can write multiple references at a time .

    I believe You are the right person to help me on this...

  • In reply to Kirti:

    modpoll and freemodbus are not Renesas products, you have exactly the same information on them as I have.

    As per the modpoll documentation :-


    The write values are given after the options and serial port for RTU :-

  • In reply to Kirti:

    Hi Kirti

    Did you made any progress on it ?

    Well i'm not software guy however i do a lot of physical layer integration and protocol testing.
    Here is my experience that may help -

    Modpoll look less user friendly. You try with other modbus master applications.
    Few are available as free on internet -
    1. RMMS modbus master simulator,
    2. Modscan,
    3. Modpoll (already tried)
    And alot more.

    There is one more useful tool for modbus frame verification -

    Try to capture modbus master and slave frames on uart or RS485 and analyze them. Sometimes master may not be properly configured.

    Narrowing down a problem always helps.
  • In reply to Yogesh-In:

    Hi Yogesh-In

    Unfortunately ,no

    I thought of using modscan ,software with modpoll library doesnot give any responses when I try to connect the device in modscan.It just polls.

    do you know modbus library which will support modscan?