FTDI adapter working… sometimes

This post is part 7 of 8 of  Sniffing the LEGO Interactive Motor

Gremlins once again.

BOOST Interactive Motor connected to the FTDI Beefy 3 adapter.

  • Wiring:
    • 6 = RX
    • 5 = TX
    • 4 = 3V3
    • 3 = GND

Just that, no pull up resistors or whatsoever.

When it works, it’s like with the Bus Pirate (including sometimes it just receiving

C0 00 3F

When it doesn’t work… I just get ’00’ after ’00’. Then I remove the 3V3 wire and/or use picocom instead of jpnevulator… and after endless tries it now works?!?

Also changed the FTDI Beefy to another USB port. But if that had any impact it wasn’t immediately.

You ought to love the scientific precision present in these posts 😀

If/when these results gets consistent… I just need an H-Bridge to control the motor and use the FTDI Beefy to read the encoder status. Why didn’t I put an H-Bridge on my holidays luggage?

Edit: found the Gremlin, doesn’t mean I understand it:

Procedure:

1. Connect the FTDI Beefy adapter to USB
2. Start picocom then exit (^A^Q)

 picocom -b 115200 /dev/ttyUSB3

3. Start jpnevulator

jpnevulator -i 10 --tty /dev/ttyUSB3 --read

4. Start adapted shell script and manually remove and reinsert power (3V3) while the Motor is receiving zeros:

#!/usr/bin/env bash

# send lots of 0's
for i in {1..50000}
do
    echo -e -n "\x00" > /dev/ttyUSB3
done

# send Init Sequence
echo -e -n "\x54\x22\x00\x10\x20\xB9" > /dev/ttyUSB3

# send Keep Alive's
for i in {1..50000}
do
    echo -e -n "\x02" > /dev/ttyUSB3
    sleep 0.1
done

So what is this Gremlin inside picocom doing?

From the man page:

Unless the –noinit option is given, it configures the device to the settings specified by the option-arguments (or to some default settings), and sets it to “raw” mode. If –noinit is given, the initialization and configuration is skipped; the device is just opened.

Looks like this “raw” mode is needed for jpnevulator to work. And exiting with ^A^Q  leaves the tty in that mode:

Quit the program *without* reseting the serial port, regardless of the “–noreset” option.

So what is this raw mode and how do I configure it without running picocom? Google points me to Configuring Linux’s serial port to raw mode by Alan C. Assis:

So stty has a ‘raw’ option and this is enough:

stty -F /dev/ttyUSB3 115200 raw

And it works. Yes, it really does!

That’s also the reason Bus Pirate was also working: I was using picocom to configure it.

Argh, so many nights with such a silly issue.

Series Navigation<< Progress at lastThe end is near >>

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *