Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    DuetTestSPI tool available

    Scheduled Pinned Locked Moved
    Third-party software
    1
    1
    343
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Danalundefined
      Danal
      last edited by Danal

      Given what was going on in this thread, where SPI problems are suspected, I decide to whip together a utility that would combine all the suggested tests, give "Duet relevant" messages to be more useful to an end user, and etc.

      If anyone wants to use it for support, it is: https://github.com/DanalEstes/DuetTestSPI

      Install via Either:

      git clone https://github.com/DanalEstes/DuetTestSPI

      or, if you want just the binary:

      wget https://github.com/DanalEstes/DuetTestSPI/raw/master/DuetTestSPI
      chmod 744 DuetTestSPI

      Example where all checks passed:

        ./DuetTestSPI
      spi mode: 0x0
      bits per word: 8
      max speed: 8000000 Hz (8000 KHz)
      TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
      RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
      Loopback on pins 19-21, SPI MOSI MISO tested successfully.
      
      Testing SPI CE0 on pin 24, GPIO 8 as an input.
      Testing via jumper from adjacent pin 22, gpio 25, as output.
      gpio=25 mode= 1 level=1
      gpio= 8 mode= 0 level=1
      gpio=25 mode= 1 level=0
      gpio= 8 mode= 0 level=0
      Send pin 22 and receive pin SPI CE0 on pin 24, GPIO 8 matched.
      
      SPI Buffer size correctly set to 8192.
      
      All tests passed, SPI should work for Duet 3 <> Raspberry Pi.
      

      Example where SPI loopback failed:

      ./DuetTestSPI
      spi mode: 0x0
      bits per word: 8
      max speed: 8000000 Hz (8000 KHz)
      TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
      RX | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  | ................................
      Send and receive buffers do not match!
      Check jumpers in place for testing, pin 22-24 and 19-21.
      If they are correct, this machine MAY have an SPI problem,
      and is unlikely to run correctly in a Duet3 <> Raspberry Pi configuration.
      Aborted
      

      Example where SPI CE0 loopback failed:

      ./DuetTestSPI
      spi mode: 0x0
      bits per word: 8
      max speed: 8000000 Hz (8000 KHz)
      TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
      RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
      Loopback on pins 19-21, SPI MOSI MISO tested successfully.
      
      Testing SPI CE0 on pin 24, GPIO 8 as an input.
      Testing via jumper from adjacent pin 22, gpio 25, as output.
      gpio=25 mode= 1 level=1
      gpio= 8 mode= 0 level=1
      gpio=25 mode= 1 level=0
      gpio= 8 mode= 0 level=0
      Send pin 22 and receive pin 24 do not match!
      Check jumpers in place for testing, pin 22-24 and 19-21.
      If they are correct, this machine MAY have an SPI problem,
      and is unlikely to run correctly in a Duet3 <> Raspberry Pi configuration.
      Aborted
      

      Example where SPI buffer size has not (yet) been set correctly:

      $ ./DuetTestSPI
      spi mode: 0x0
      bits per word: 8
      max speed: 8000000 Hz (8000 KHz)
      TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
      RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
      Loopback on pins 19-21, SPI MOSI MISO tested successfully.
      
      Testing SPI CE0 on pin 24, GPIO 8 as an input.
      Testing via jumper from adjacent pin 22, gpio 25, as output.
      gpio=25 mode= 1 level=1
      gpio= 8 mode= 0 level=1
      gpio=25 mode= 1 level=0
      gpio= 8 mode= 0 level=0
      Send pin 22 and receive pin SPI CE0 on pin 24, GPIO 8 matched.
      
      SPI buffer size not set to 8192, please correct via:
      echo "options spidev bufsiz=8192" | sudo tee /etc/modprobe.d/spidev.conf
      and reboot.
      Aborted
      

      Delta / Kossel printer fanatic

      1 Reply Last reply Reply Quote 2
      • First post
        Last post
      Unless otherwise noted, all forum content is licensed under CC-BY-SA