This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: spidev_test questions

Part Number: AM5728

When I run spidev_test with the loopback option I get

 root@mitysom-am57x:/opt/synchrony/bin# ./spidev_test -v -l --device /dev/spidev1.0
can't set spi mode: Invalid argument

I also considered shorting the MISO and MOSI together to do a loopback test but then I thought I would need the no chip select option so that my actual device would not be active. But when I tried that

root@mitysom-am57x:/opt/synchrony/bin# ./spidev_test -N -v -D /dev/spidev1.0
[ 182.345120] spidev spi1.0: setup: unsupported mode bits 40
can't set spi mode: Invalid argument

  • looks like there is no support for loopback in the lopts struct even though the usage says there is. Sooo, how are you guys testing loopback. Do you not have a device attached to the spi bus?

    static void print_usage(const char *prog)
    {
    printf("Usage: %s [-DsbdlHOLC3vpNR24SI]\n", prog);
    puts(" -D --device device to use (default /dev/spidev1.1)\n"
    " -s --speed max speed (Hz)\n"
    " -d --delay delay (usec)\n"
    " -b --bpw bits per word\n"
    " -i --input input data from a file (e.g. \"test.bin\")\n"
    " -o --output output data to a file (e.g. \"results.bin\")\n"
    " -l --loop loopback\n"
    " -H --cpha clock phase\n"
    " -O --cpol clock polarity\n"
    " -L --lsb least significant bit first\n"
    " -C --cs-high chip select active high\n"
    " -3 --3wire SI/SO signals shared\n"
    " -v --verbose Verbose (show tx buffer)\n"
    " -p Send data (e.g. \"1234\\xde\\xad\")\n"
    " -N --no-cs no chip select\n"
    " -R --ready slave pulls low to pause\n"
    " -2 --dual dual transfer\n"
    " -4 --quad quad transfer\n"
    " -S --size transfer size\n"
    " -I --iter iterations\n");
    exit(1);
    }

    while (1) {
    static const struct option lopts[] = {
    { "device", 1, 0, 'D' },
    { "speed", 1, 0, 's' },
    { "delay", 1, 0, 'd' },
    { "bpw", 1, 0, 'b' },
    { "input", 1, 0, 'i' },
    { "output", 1, 0, 'o' },
    { "loop", 0, 0, 'l' },
    { "cpha", 0, 0, 'H' },
    { "cpol", 0, 0, 'O' },
    { "lsb", 0, 0, 'L' },
    { "cs-high", 0, 0, 'C' },
    { "3wire", 0, 0, '3' },
    { "no-cs", 0, 0, 'N' },
    { "ready", 0, 0, 'R' },
    { "dual", 0, 0, '2' },
    { "verbose", 0, 0, 'v' },
    { "quad", 0, 0, '4' },
    { "size", 1, 0, 'S' },
    { "iter", 1, 0, 'I' },
    { NULL, 0, 0, 0 },