Need help setting up NRF52 for serial connection to IDE

Posted on
  • I'd like to use Web Serial (not Web Bluetooth) for IDE on an NRF52 breakout board.. Here are lines from the board file:

    info = {
     'name' : "C20 smartwatch",
     'boardname' : 'C20X', 
     #'default_console' : "EV_BLUETOOTH",
     'default_console' : "EV_SERIAL1",
     'default_console_tx' : "D5",
     'default_console_rx' : "D7",
     'default_console_baudrate' : "38400",
    ...
    

    The build works (I still have Bluetooth in the libraries and my test board can connect to the IDE that way). I'm using a CP2102 to connect with TXD going to D7, RXD to D5 (and I've tried it reversed as well). Wiring to D7/D5 is solid. I've set the IDE to use the same baudrate for Serial. When I try to use Web Serial, I get:

    Unable to retrieve board information. Connection error?

    What am I missing?

  • It needs to be connected at boot time. There is check that RX is pulled high otherwise serial is not enabled. Keeping serial enabled draws about 1mA constantly.

    You can try from bluetooth connection to call Serial1.setup and then try Serial1.setConsole to see if it starts working.

  • As @fanoush says really... Also you could try without 'default_console_baudrate' : "38400", and just use 9600 as a start because that's what Espruino usually defaults to (including the IDE).

    ... so it could be that it's all working and the IDE's baud rate is wrong?

    Once connected by Bluetooth you could do Serial1.println("Hello") and Serial1.on("data",print) to check out if RX/TX is working separately

  • I made sure it was all wired at power up and sure enough, it lit up just fine (@ 38400 too). This will be interesting as my true target for this is battery powered. Maybe I'll add a watch on button hold to enable Serial1 and setConsole...

    Either way, thank you both! One step forward.

    (BTW: the target board is a C20 smartwatch [https://www.aliexpress.com/item/33025338­264.html] which were on sale last year for $10US. One became an experiment and I somehow fried the BT system, so looking for an alternate console. )

  • you can monitor RX pin with setWatch (with input pulldown) and when it goes up you reconfigure it as serial, I had it like this on DS-D6
    https://gist.github.com/fanoush/ce461c73­c299834bcb53a615721b5a2e#file-dsd6-js-L2­34

    You could also have pull up and monitor when it goes low if the serial is permanently attached and the pin is high but first character may be lost, which is still ok for console if you first press Enter and wait a bit.

    For ds-d6 I went with first option so console was enabled when I plugged it into usb female attached to usb serial adapter.

  • As always, thanks for your insights, @fanoush.. great idea.

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

Need help setting up NRF52 for serial connection to IDE

Posted by Avatar for yngv126399 @yngv126399

Actions