PACA Serial Ports

Discussion in 'C-Bus Automation Controllers' started by PeterW, Dec 31, 2021.

  1. PeterW

    PeterW

    Joined:
    Dec 26, 2021
    Messages:
    15
    Likes Received:
    0
    Hi all - first time poster hopefully in correct forum.

    I'm trying to use a 5500PACA to control a Somfy RS485 wireless controller but having difficulty in getting it to work.

    If i send commands via a laptop serial port directly to Somfy controller with a straight thru DB9 cable works fine,

    If i use the PICED environment on a laptop (code below) to control the laptop serial port with same DB9 cable also works fine.

    But once i transfer the project to the PACA no joy.

    The code i have in test mode is extremely simple and I can verifiy that the code is executed as the 'bed 3 desk' light comes on when i press the button so i know its executing the code but not moving the blind.

    Code is

    Initialisation:

    If isPac then
    begin
    OpenSerial(1, 1, 4800, 8, 1, scNoFlowControl, scOddParity);
    end;

    Module:

    once (GetLightingState("Bed 3 Blind") = off) then
    begin

    Blind3Close := #$7F#$F2#$FA#$01#$00#$00#$3E#$28#$FA#$FD#$FD#$05#$C6;
    SetLightingLevel("Bed 3 Desk", 100%, "0s");
    WriteSerial(1, Blind3Close);

    end;

    So either the serial port(s) on the PACA is faulty (and by the way i have used both serial port 1 and 2 to test and connected 24V ac to the PACA) or more likely i suspect the cable i have made between the PACA and Somfy unit (RJ45 to DB9M) is not wired correctly but it seems correct according to Clipsal spec for RS232 pinouts

    Cable I have made is

    RJ45 (as per clipsal notes) Standard RS232 DB9M

    1 DCD 1
    2 DSR 6
    3 DTR 4
    4 GND 5
    5 RD 2
    6 TD 3
    7 CTS 8
    8 RTS 7

    Any help would be greatly appreciated as i'm losing what little hair i have !

    Thanks in advance,
     
    PeterW, Dec 31, 2021
    #1
  2. PeterW

    Conformist

    Joined:
    Aug 4, 2004
    Messages:
    757
    Likes Received:
    66
    Location:
    Adelaide, South Australia
    Hey Peter
    Have you tried connecting the serial port of the PACA to your PC's serial port to see what (or if) the command is as expected? I remember having an issue with sending serial commands from a PACA. I'll dig thru my notes to see what I can find.

    Update... I had issues with the RX and TX on my project. I needed to swap pins 2 & 3 to get things to work.
     
    Last edited: Dec 31, 2021
    Conformist, Dec 31, 2021
    #2
  3. PeterW

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    Could this be the problem 'Somfy RS485 wireless controller' its a lot of years since i used a pac serial port do they support rs485 are you going through an adapter ?

    To test the port can you not link TD to RD in the pac to echo back what you send ?

    Or as above link it to your PC

    Michael
     
    xrmichael, Dec 31, 2021
    #3
  4. PeterW

    PeterW

    Joined:
    Dec 26, 2021
    Messages:
    15
    Likes Received:
    0
    HI Guys, did a quick change and flipped rd/td on the cable and still no joy.

    I also hooked it up to a serial port on laptop with a trace on and not a whisper so appears that nothing is sending out of the PACA which is what i suspected anyway. I'm still not sure on the cabling just wondering if maybe some of the control lines like DTR/DSR etc need to be tied together to get the PACA to think there is something connected or does it really only need rd/td and gnd ??

    Oh and michael yes have an rs485/rs232 adapter on the somfy controller as i said with a direct connect from laptop serial port to somfy works a treat through the PICED interface.

    Looks like headache will continue into 2022 !!

    But if you guys think of anything else i can try I'm happy to give it a go
     
    PeterW, Dec 31, 2021
    #4
  5. PeterW

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    Ill have a play with a pac at home to check the serial settings, recovering from a knee operation at present so not much else to do.

    M
     
    xrmichael, Dec 31, 2021
    #5
  6. PeterW

    Conformist

    Joined:
    Aug 4, 2004
    Messages:
    757
    Likes Received:
    66
    Location:
    Adelaide, South Australia
    I'm going to suggest that you try sending a simple command from the PAC to your PC's serial port (not the formed command for Somfy) ... something like ~~ +CR+LF.
    BTW, is there a CR+LF at the end of your string you are sending?
     
    Conformist, Jan 1, 2022
    #6
  7. PeterW

    PeterW

    Joined:
    Dec 26, 2021
    Messages:
    15
    Likes Received:
    0
     
    PeterW, Jan 2, 2022
    #7
  8. PeterW

    PeterW

    Joined:
    Dec 26, 2021
    Messages:
    15
    Likes Received:
    0
    Tried the simple command still no luck and there is no CR/LF at the end of the blind movement string (BLIND3CLOSE as above).

    I'm starting to suspect that the rs232 on the PACA are faulty cant be this hard ??
    Hi Michael if i bridged pin 2 and 3 to echo back how could i actually check that ?
     
    PeterW, Jan 2, 2022
    #8
  9. PeterW

    grssll

    Joined:
    Jun 13, 2014
    Messages:
    64
    Likes Received:
    0
    Location:
    Sydney
    Hi,
    Try something like this:
    Initilisation:
    OpenSerial(1, 1, 4800, 8, 1, 0, 1);

    Code example:
    once (GetLightingLevel("55_front sensor") >= 3%) then
    begin
    WriteSerial(1, #$fc#$f0#$ff#$05#$05#$4a#$ff#$ff#$ff#$ff#$ff#$ff#$ff#$0a#$38#$fc);
    end;
     
    grssll, Jan 2, 2022
    #9
  10. PeterW

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    Had a play around with an old pac that i have had for ages

    ini code
    OpenSerial(1, 1, 9600, 8, 1, 0, 0);

    vars
    testcounter:integer;
    CommandString:string;

    module
    Delay("0:00:05");
    testcounter:=testcounter+1;
    Format(CommandString, 'testcounter', testcounter, #13#10);
    WriteSerial(1,CommandString);
    Delay("0:00:02");
    WriteSerial(1,#$7F#$F2#$FA#$01#$00#$00#$3E#$28#$FA#$FD#$FD#$05#$C6);
    once testcounter = 10 then

    begin
    testcounter:=0;
    end

    ethernet cable in port 1 of pac into rs232 port of pc running docklight blue ground green tx from pac

    your string and then a test string

    upload_2022-1-2_17-11-29.png
     
    xrmichael, Jan 2, 2022
    #10
  11. PeterW

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    this will echo back to your pc if its all wired up correct

    ReadSerial(1,rxstring,'');
    if length(rxstring)>0 then
    begin
    writeserial(1,'yousaidthis'#13#10);
    WriteSerial(1,rxstring);
    end;
     
    xrmichael, Jan 2, 2022
    #11
  12. PeterW

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    To test with no pc link tx rx and send string hello if the pac's rs232 port is all ok it will pulse the light

    ReadSerial(1,rxstring,'');
    if length(rxstring)>0 then
    begin
    if (rxstring)='hello'
    then begin
    writeserial(1,'well hello'#13#10);
    PulseCBusLevel("network", "Lighting", "the light", 100%, "0s", "0:00:05", 0%);
    end
    else begin
    writeserial(1,'yousaidthis'#13#10);
    WriteSerial(1,rxstring);
    end
     
    xrmichael, Jan 2, 2022
    #12
  13. PeterW

    PeterW

    Joined:
    Dec 26, 2021
    Messages:
    15
    Likes Received:
    0
    Morning, thanks for the input i'm going to try that exact code can you do me one more favour can you confirm the wiring on the cable you are using to go from Pac port 1 to rs232 port on pc

    What pins on the rj45 go to what pins on the 9 or 25 pin connector to your pc so i can replicate exactly ?

    Thanks !!
     
    PeterW, Jan 2, 2022
    #13
  14. PeterW

    PeterW

    Joined:
    Dec 26, 2021
    Messages:
    15
    Likes Received:
    0
    Hi Guys, so after a lot of hours stuffing around i think i understand what the problem really is but still not sure about the solution.

    It appears that the root cause of the issues are that the PAC doesn't set voltages as per a 'normal' rs232 port.

    As previously indicated i have no issues with getting the code to work directly from a laptop or via simulation in PICED so thanks to Michael and replicating exactly what he sent thru and most importantly using docklight to monitor the serial port i could see that his code worked fine and also discovered that using docklight my code was also fine !.

    It appears that the serial monitor software i use does not work because it doesnt like the fact that the PAC is not raising lines appropriately but somehow docklight must not care as it correctly detected the output. Simply alternating between the 2 monitors showed data in docklight but not in the monitor i was using which then lead me to check the voltage on the output side of the RS485 interface and that is the issue.

    When i use the laptop serial port directly and check the voltage on rs485 i can see +5v and the somfy blinds respond as expected. However when i use the cable from the PAC there is no voltage and although its sending the correct data they aren't being converted thru the RS485 convertor and hence blind does not respond.

    So i'm thinking that i need to add a power supply and power up some pins on the RS232 connector out of the PAC but thats where i;m stuck not sure what voltage (+5V ??) and what pins need to be raised. I thought i'd be clever and put +5V on output side of rs485 interface but that didnt work probably because internally it needs the rs232 input to generate appropriately.

    So this problem has now moved from being a PAC problem to more of a cabling issue which i kind of suspected from the start

    Happy for any ideas thanks !
     
    PeterW, Jan 3, 2022
    #14
  15. PeterW

    PeterW

    Joined:
    Dec 26, 2021
    Messages:
    15
    Likes Received:
    0
    Actually just came across this on the internet which is exactly my configuration and you can clearly see that they have a power supply going into the rs232/rs485 adapter so i'll give them a call they probably wont share the info and want me to buy but you never know .......

    If i can get it i will share the result and hopefully save headaches for anyone else :)
    upload_2022-1-3_17-10-6.png
     
    PeterW, Jan 3, 2022
    #15
  16. PeterW

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    The somfy 1810872 is rs232 and 485, ill let you know the pin outs later i also have a few 232/485 adapters ill try and see if the pac will drive any off them
     
    xrmichael, Jan 3, 2022
    #16
  17. PeterW

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    Capture.PNG IMG_0663.JPG pacport.PNG from the pac to the pc


    I have ran into the same problem as you now, soon as i introduce a pac>232>485-485>232>pc adapter nothing


    Tried 3 seperate adapters one that can be externally powered, though not pinned the ctr/rts/dce etc in yet so this could be an issue


    All work fine docklightpc1<>rs232<>rs485<>rs485<>rs232<>pc2docklight


    I am going to dust off the scope, or does this justify a nice new one ?
     

    Attached Files:

    xrmichael, Jan 3, 2022
    #17
  18. PeterW

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    IMG_0664.JPG IMG_0665.JPG 1st image from the pac around 20m of cable from the scope,01010101 at 600baud
    2nd from the pc usb to rs232 interface next to scope.
     
    xrmichael, Jan 3, 2022
    #18
  19. PeterW

    PeterW

    Joined:
    Dec 26, 2021
    Messages:
    15
    Likes Received:
    0
    Hmm so i'm a computer programmer.... CRO are out of my depth and although i can tell from pulses that they are both generating 0/1 and that the voltages seem to be reversed on A and B doesnt mean that much to me
    Does it help in understanding what pin(s) need to be powered to drive the 485 interface ?

    Appreciate your input its great to have another set of eyes
     
    PeterW, Jan 3, 2022
    #19
  20. PeterW

    grssll

    Joined:
    Jun 13, 2014
    Messages:
    64
    Likes Received:
    0
    Location:
    Sydney
    Do you have a rs232 to 485 converter in your setup?
    Also converter must be full duplex if I remember correctly.
    Cheers
     
    Last edited: Jan 4, 2022
    grssll, Jan 4, 2022
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.