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

Raspberry Pi I2C_master -> unidentifyable transmission

2019-10-22
2019-10-26
  • KKempeneers - 2019-10-22

    Hi,

    Maybe someone experiences the same behaviour and is able to suggest some fixes.

    When using some homemade I/O for Codesys RPi I noticed unwanted spikes on the outputs that lasted for some milliseconds (ie. one PLC scan)

    When I log the data that is received by an Arduino Slave device I notice:

    5: 0 A7 58 8A 75 
    5: 0 A8 57 8C 73 
    5: 0 A9 56 8E 71 
    [b]8: 0 55 21 FF FF FF FF FF[/b] 
    5: 0 AC 53 94 6B 
    5: 0 AD 52 96 69 
    5: 0 AE 51 98 67 
    5: 0 AF 50 9A 65 
    

    The number in front of the semicolon is the number of bytes receives, the data after the semicolon is the data received. Obviously the bold data is an unwanted received datagram. The data is send by an FB:

    // Analog (PWM) outputs
    txBuffer[1] := analogOut0;
    txBuffer[2] := analogOut2;
    txBuffer[3] := analogOut4;
    txBuffer[4] := analogOut6;
    // Transmit the digital outputs 
    txBuffer[0].0 := digitalOut1;
    txBuffer[0].1 := digitalOut3;
    txBuffer[0].2 := digitalOut5;
    txBuffer[0].3 := digitalOut7;
    state := I2C_master.write(baseAddress, ADR(txBuffer), 5);
    

    I wrote a Python program to test the hardware, nothing unexpected shows up!

    What could cause this? Any suggestions?

    Kind regards,

    Koen Kempeneers

     

    Related

    Talk.ru: 1
    Talk.ru: 2
    Talk.ru: 3

  • KKempeneers - 2019-10-25

    No it does not ...

    The data is send from the PI to the slave. However ... it is still possible that the slave interpretes a spike as an SCL transition. But still I find this very strange since the hardware has undergone serious testing using a python program. Unless smbus uses lower bitrates than Codesys I2C master ...

    Can the bitrate be changed in Codesys?

    Koen.

     

Log in to post a comment.