Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

J1939 problem with receive on IFM CR0505

2013-05-17
2013-05-24
  • krzysiekkn88 - 2013-05-17

    Hi,
    I have a problem with IFM CR0505 controller and J1939 protocol. In my application I use Can2 bus with J1939 protocol to collect data from Mercedes diesel engine ECU and Can1 bus with CANopen protocol to send the data to IFM Cr0451 display. At first look everything is working fine, I can see the collected data on the screen, but when I started to control repetition of J1939 messages it turned out that I receive only one message on twenty or thirty. I know that because I watch the traffic and frames on the Can2 bus.

    On the 0505 controller I use V060003 firmware and ifm_J1939_2_V060003 library. I initialize CAN2 with baudrate 250 and extended mode then I initialize J1939_2 with address 33. The function block J1939_2_RECEIVE (which is of course initialized first) receives messages and returns me for most of the time (after the timer in RPT) result = 3 which means that the data did not arrived on time. Sometimes it returns result = 1 which means that the data was received and then it changes on the screen. I checked in the j1939 standard and by watching frames on bus if the time in repetition control is not to short, but even if it is ten or twenty times longer then the real time between frames nothing changes, only one on some time is received correctly. I try read about 10 parameters from J1939 and problem occurs with all of them.

    The J1939_2_RECEIVE block:
    VAR
    ( for example )
    J1939_RECEIVE: J1939_2_RECEIVE;
    PGN WORD := 65262;
    PeriodTime :TIME := T#10s;
    J1939Data: ARRAY [0..7] OF BYTE;
    END_VAR

    J1939_RECEIVE
    (
    ENABLE := TRUE,
    CONFIG := FALSE, ( Make it TRUE for 1 cycle at init. phase )
    PG := 0, ( Page address. Normally = 0 )
    PF := DWORD_TO_BYTE(SHR(PGN,8)), ( PDU Format Byte )
    PS := DWORD_TO_BYTE(PGN), ( PDU Specific Byte )
    DST := ADR(J1939Data), ( Address to store the received data )
    RPT := PeriodTime, ( To supervise the repetition of transmit messages )
    LIFE := 3,
    RESULT => result,
    DEVICE => device
    );

    Part of the log from Can2 bus:
    ; CAN ON 250 kbit/s
    ;Count ;Time(ms) ;ID (dec);ID (hex) ;DLC ; DATA ; Type ; RTR;DIR; Interpretation
    ;---------------------------------------------------------------------------------------------------------
    3183 ;1235,1137 ;418381839 ;$18F0000F ;8 ; 06 7D FF FF FF FF FF FF ; 29bit ;----;Rx ;
    3182 ;1235,1132 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3181 ;1235,1038 ;419356416 ;$18FEDF00 ;8 ; 7D FF FF FF FF FF FF FF ; 29bit ;----;Rx ;
    3180 ;1235,1032 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3179 ;1235,0944 ;419362304 ;$18FEF600 ;8 ; FF 32 59 FF FF FF FF FF ; 29bit ;----;Rx ;
    3178 ;1235,0938 ;419360512 ;$18FEEF00 ;8 ; FF FF CD 00 FF FF FF FF ; 29bit ;----;Rx ;
    3177 ;1235,0932 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3176 ;1235,0832 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3175 ;1235,0738 ;217056000 ;$0CF00300 ;8 ; F1 00 00 FF FF FF FF FF ; 29bit ;----;Rx ;
    3174 ;1235,0732 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3173 ;1235,0633 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3172 ;1235,0533 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3171 ;1235,0433 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3170 ;1235,0333 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3169 ;1235,0239 ;217056000 ;$0CF00300 ;8 ; F1 00 00 FF FF FF FF FF ; 29bit ;----;Rx ;
    3168 ;1235,0233 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3167 ;1235,0151 ;419361280 ;$18FEF200 ;8 ; 00 00 FF FF 00 00 FF FF ; 29bit ;----;Rx ;
    3166 ;1235,0145 ;419361024 ;$18FEF100 ;8 ; FC 00 00 70 00 00 1F F0 ; 29bit ;----;Rx ;
    3165 ;1235,0139 ;418381839 ;$18F0000F ;8 ; 06 7D FF FF FF FF FF FF ; 29bit ;----;Rx ;
    3164 ;1235,0134 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3163 ;1235,0034 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3162 ;1234,9934 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3161 ;1234,9834 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3160 ;1234,9740 ;217056000 ;$0CF00300 ;8 ; F1 00 00 FF FF FF FF FF ; 29bit ;----;Rx ;
    3159 ;1234,9735 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3158 ;1234,9635 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3157 ;1234,9535 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3156 ;1234,9435 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3155 ;1234,9335 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3154 ;1234,9242 ;217056000 ;$0CF00300 ;8 ; F1 00 00 FF FF FF FF FF ; 29bit ;----;Rx ;
    3153 ;1234,9236 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3152 ;1234,9154 ;419361280 ;$18FEF200 ;8 ; 00 00 FF FF 00 00 FF FF ; 29bit ;----;Rx ;
    3151 ;1234,9148 ;419361024 ;$18FEF100 ;8 ; FC 00 00 70 00 00 1F F0 ; 29bit ;----;Rx ;
    3150 ;1234,9142 ;418381839 ;$18F0000F ;8 ; 06 7D FF FF FF FF FF FF ; 29bit ;----;Rx ;
    3149 ;1234,9136 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3148 ;1234,9037 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3147 ;1234,8936 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3146 ;1234,8836 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3145 ;1234,8742 ;217056000 ;$0CF00300 ;8 ; F1 00 00 FF FF FF FF FF ; 29bit ;----;Rx ;
    3144 ;1234,8737 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3143 ;1234,8637 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3142 ;1234,8543 ;419356416 ;$18FEDF00 ;8 ; 7D FF FF FF FF FF FF FF ; 29bit ;----;Rx ;
    3141 ;1234,8537 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3140 ;1234,8437 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3139 ;1234,8338 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3138 ;1234,8243 ;217056000 ;$0CF00300 ;8 ; F1 00 00 FF FF FF FF FF ; 29bit ;----;Rx ;
    3137 ;1234,8238 ;217056256 ;$0CF00400 ;8 ; F4 FA 7D 00 00 80 3E FF ; 29bit ;----;Rx ;
    3136 ;1234,8155 ;419361280 ;$18FEF200 ;8 ; 00 00 FF FF 00 00 FF FF ; 29bit ;----;Rx ;

    I would appreciate any help.

     
  • krzysiekkn88 - 2013-05-18

    I forgot to mention that the problem only occurs when I'm connected to engine bus. I have a simple program on other plc that generates j1939 frames with set repetition frequency and while testing I don't get any errors. It is very frustrating, please help

     
  • krzysiekkn88 - 2013-05-24

    Problem solved. I had to write new j1939 library for the controller.

     

Log in to post a comment.