Connecting Puck.js to wired Serial

Posted on
  • Hey there!

    So I have a Puck.js v2, and I followed https://www.espruino.com/Puck.js#serial-­console to hook it up to an FT232R -- Pin 28 to RX, Pin 29 to TX, set VCC to 3.3V, ran to 3v, and ground to ground.

    The puck fires up, but refuses to talk via Serial1.

    If I go in to the IDE via BT, Serial1.available() reports 0.

    Serial1.setConsole(true) just makes it not respond via BT any more, and doesn't get the wired serial side working.

    Any ideas?

  • what about GND, is it connected too?

  • GND is connected to GND...

    I'm using this https://www.amazon.com/gp/product/B07XF2­SLQ1.

    TTL's pins are: DTR, RX, TX, VSS, CTS, GND

    Puck -> FT232R connections are:
    V3 -> VCC (set at V3.3 and not V5)
    GND -> GND
    D28 -> RX
    D29 -> TX

    (edit: changed pin TS to CTS -- misread it)

  • Here you find the howto

    Serial is only checked during power up.

  • What baud rate are you connecting with? You'll need 9600 baud (the default).

    The best way to test is when connected with Bluetooth you can run the commands:

    Serial1.on('data',d=>print("Serial>",JSO­N.stringify(d));
    Serial1.println("Hello");
    

    So you can see if any data is being received and can try pushing data.

    As @MaBe says you'll need to apply power to the puck while it is connected to the FT232R (which is plugged into USB). Enabling the Serial port uses quite a bit of battery power so Puck.js only does it when it's sure there is a connection.

    Or you can also try enabling it manually with:

    Serial1.setup(9600,{rx:D29,tx:D28});
    
  • Yeah, this made me wonder..

    Firstly, I am doing this all without a battery in.

    So then I plug it all in to the USB-TTL (as described above), and then plug the USB-TTL in to the computer.

    When that didn't work, I tried pulling the connection for 3V and plugging it back in.

    That didn't work.

    I tried similar with GND, and that didn't work either.

  • I'm using the defaults when I pick the device in Serial2, I think it's something like 9600,8,N,1 ? I can check tonight to be sure, but I know I was using at least 9600 baud, 8 bits, and no parity.

    I'll have to try the first script set you gave me later tonight as well, but I did try Serial1.println("blah") and got nothing.

    Shouldn't

    Serial1.setup(9600,{rx:D29,tx:D28});
    

    be

    Serial1.setup(9600,{rx:D28,tx:D29});
    

    ?

  • Well, try this

    • rx (D29) on Puck get's connected to tx on FT232R

    • tx (D28)on Puck get's connected to rc on FT232R

    • 3V on Puck to 3V3 on FT232R

    • GND to GND

    Hint: remove the battery :) so you can connect 3V3 to boot

    Hope this helps and you get the serial working.

  • Shouldn't ... be ...

    http://www.espruino.com/Puck.js#pinout shows D29 is RX and D28 is TX - so I think Serial1.setup(9600,{rx:D29,tx:D28}); is right.

    But with UARTs you have to connect RX to TX and vice-versa, which may be the source of confusion. Also some USB-TTL dongles are named based on what you should connect the pins to vs what the pin actually is - so you can never be sure.

    For short periods of time it's not going to do any damage having them swapped over, so if it's not working it's worth trying both ways.

  • Well, I got a little closer messing with it last night...

    First off -- this has all been with the battery removed. I was like "Oh? I can test this without spending battery at all? Yes please." :D

    Now... what I got working was: I could receive data in the puck FROM the terminal.

    I could not, however, get output from the puck to show up on the terminal. At all.

    I assumed maybe I had a bad soldering job or something, but when I flipped the TX/RX pin connections and in the .setup() call... I could receive terminal input!

    So... both of the connections seem solid.

    Then I noticed on the FT232R, it's got TX and RX lights that fire up when data transmits over the respective channel.

    Nothing I did could get the lights to blink when sending output to the console. Serial1.print(), Serial1.println()... none of it seemed to trigger actual outgoing data.

    I believe I tested swaping the TX/RX pins as well.

    Tonight I'll grab a different FT232R and do some more testing.

  • That's a good point about the "context" of TX/RX -- it's all relative.

  • Hmm, connecting via serial terminal is not so easy, because you need special setting.

    Better use the WebIDE

  • Well, if I weren't planning on trying to do some bluetooth stuff, that would be viable, however I have an aversion to "debugging via rumor", so getting bluetooth connectivity working without active terminal looks pretty dark... :)

  • Swapping out for another FT232R did the trick! YAY! Thanks everyone.

    At least on the FT232R's I have, D28 goes to RX, and D29 goes to TX.

  • Great, have fun and don’t miss to share what you are working on.

  • Sure thing! @DanTheMan827 and I are actually working towards the same (or at least substantially similar) goals.

    The root of my project is this thing I'm calling the AmiiBuddy, which I have a short demo of here.

    I have all of the basics working with a rewritable magic NTag215 card, but the idea of being able to have the device communicate the nfc info over a longer distance seems too great to not at least explore. :)

  • Swapping out for another FT232R did the trick!

    Interesting - I've had some dodgy 'clone' boards in the past, but nothing that plain didn't work.

    If it helps - in future if you ever stop trusting it, disconnect everything from it and connect RX and TX together. Then when you type in the terminal it should echo back to you - if it doesn't the FT232 is likely broken :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Connecting Puck.js to wired Serial

Posted by Avatar for user115873 @user115873

Actions