Building for NRF52 boards

Great! Really exciting news. The repo for v1.1 is https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay
Note that I might have connected that high side mosfet of the GPS incorrectly in this version but the rest should work. Unfortunately I did not create variant files for this version.
Did @einzeln00 install a screen too?

1 Like

I didnā€™t change anything from repo. Screen? yes, I didnā€™t get the click and switch. I want to re-create it from chip not module if everything works as expected.

2 Likes

Cool! Hope you get that strange nrf52840 package soldered. Never tried that before. Those sx126x chips seem to require less external components than their ancestors though

1 Like

@einzeln00 and @Corvus so I have the code added and I think it has a pretty good chance of ā€˜just workingā€™ - but Iā€™ll debug once I have it flashed. ( Iā€™m doing the work in this branch: https://github.com/geeksville/Meshtastic-esp32/tree/post1 )

One question: To get the bootloader (and initial appload) flashed I need to use the SWDIO/SWCLK pins. Are those ā€œSWCā€ and ā€œSWOā€ testpoints on the back of the board? If so, Iā€™ll tacksolder my debug wires there.

Also I saw this note in your sketch:

  //pinMode(PHOLD, INPUT); //PHOLD not used in my setup. I even cut its trace close to the nrf module and the EN pin of the LDO is pulled up ti VHI via regular spst switch

Do I need to do this rework or can I instead just drive PHOLD high in my startup code?

1 Like

Thumbs up!
Correct, SWC and SWD are the programming pins.

This must be the ā€˜boost enableā€™ pin in 1.1 if I remember correctly so driving it high is necessary to power the lora module.
Good luck!

1 Like

Woot! @Corvus and @einzeln00 your board is very nice :wink:

Basic support for this board has now been added to the branch I linked above. Iā€™ll merge it into mainline later this week. You should be able to just build it in the IDE and it will generate a suitable hex file and allow programming that file via the Jlink ICE.

Or alternatively you can run bin/upload-to-bootloader.sh and it will look for a mounted bootloader flash filesystem and program the device with a UF2 file.

Iā€™ve added this board to the list of ā€œstandard/supportedā€ boards and when I next build an official release youā€™ll now find prebuilt UF2 binaries which can be used to update existing boards over USB or bluetooth.

Two work items remain:

  • Supporting the screen you used
  • Supporting the battery power measurement chip you used

But I probably wonā€™t work on these two items for a couple of days (need to fix a python bug first and help with iOS BLE)

Minor bit of feedback for future spins of this great board:

  • It would be great if you could putdown a footprint for optional installation of a standard mini ARM 5x2 SWD header, so that it is easier to hook up the ICE.
  • If you still use a TFT display in the next version, one a bit taller would make existing layouts fit more easily. 80x160 pixels is not a lot when trying to show text
Emitting reboot packet for serial shell
I2C device found at address 0x55
done
Meshtastic swver=unset, hwver=unset
Reset reason: 0x4
FIXME, call randomSeed
ERROR: No UBLOX GPS found
Hoping that NEMA might work
RadioConfig reset!
Initial packet id 1481765933, numPacketId 4294967295
No saved preferences found
NODENUM=0xB18C3A4E, dbsize=1
Starting meshradio init...
Set radio: name=Default, config=3, ch=6, power=17
SX1262 init result 0
sending owner !df5db18c3a4e/Unknown 3a4e/?4E
Update DB node 0xB18C3A4E, rx_time=0
old user !df5db18c3a4e/Unknown 3a4e/?4E
updating changed=0 user !df5db18c3a4e/Unknown 3a4e/?4E
Adding packet record (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 Payload:User)
enqueuing for send (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted)
txGood=0,rxGood=0,rxBad=0
Starting low level send (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted)
Initialise the Bluefruit nRF52 module
Configuring the Device Information Service
Configuring the Battery Service
Configuring the Mesh bluetooth service
Setting up the advertising payload(s)
Advertising
Completed sending (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted)
Lora RX (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim2 encrypted)
Rx someone rebroadcasting for us (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim2 encrypted)
Found existing packet record for fr=0xB18C3A4E,to=0xFFFFFFFF,id=1481765936
Ignoring incoming msg, because we've already seen it: fr=0xB18C3A4E,to=0xFFFFFFFF,id=1481765936,hop_limit=2
Lora RX (id=0x7B4689D1 Fr0x38 To0x4E, WantAck0, HopLim3 encrypted)
Adding packet record (id=0x7B4689D1 Fr0x38 To0x4E, WantAck0, HopLim3 encrypted)
FIXME not implementedFIXME-update-db Sniffing packet
Delivering rx packet (id=0x7B4689D1 Fr0x38 To0x4E, WantAck0, HopLim3 Payload:User)
Ignoring incoming packet - not a position
Forwarding to phone (id=0x7B4689D1 Fr0x38 To0x4E, WantAck0, HopLim3 Payload:User)
Update DB node 0xABDDDF38, rx_time=0
old user //
updating changed=1 user !2462abdddf38/Bob b/Bb
Node status update: 2 online, 2 total
Telling client we have new packets 1
Telling client we have new packets 1
BLE notify fromNum
Sending position to mesh
Update DB node 0xB18C3A4E, rx_time=0
Node status update: 2 online, 2 total
Stripping time 0 from position send
Adding packet record (id=0x5851F431 Fr0x4E To0xFF, WantAck0, HopLim3 Payload:Position)
enqueuing for send (id=0x5851F431 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted)
txGood=1,rxGood=2,rxBad=0
Starting low level send (id=0x5851F431 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted)
Completed sending (id=0x5851F431 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted)
Lora RX (id=0x5851F431 Fr0x4E To0xFF, WantAck0, HopLim2 encrypted)
Rx someone rebroadcasting for us (id=0x5851F431 Fr0x4E To0xFF, WantAck0, HopLim2 encrypted)
Found existing packet record for fr=0xB18C3A4E,to=0xFFFFFFFF,id=1481765937
Ignoring incoming msg, because we've already seen it: fr=0xB18C3A4E,to=0xFFFFFFFF,id=1481765937,hop_limit=2
Update DB node 0xB18C3A4E, rx_time=0
Node status update: 2 online, 2 total
Update DB node 0xB18C3A4E, rx_time=0
Node status update: 2 online, 2 total
Update DB node 0xB18C3A4E, rx_time=0
Node status update: 2 online, 2 total
Update DB node 0xB18C3A4E, rx_time=0
Node status update: 2 online, 2 total
Lora RX (id=0x55AF1123 Fr0x38 To0xFF, WantAck0, HopLim3 encrypted)
Adding packet record (id=0x55AF1123 Fr0x38 To0xFF, WantAck0, HopLim3 encrypted)
Rebroadcasting received floodmsg to neighbors, fr=0xABDDDF38,to=0xFFFFFFFF,id=1437536547,hop_limit=2
enqueuing for send (id=0x55AF1123 Fr0x38 To0xFF, WantAck0, HopLim2 encrypted)
txGood=2,rxGood=4,rxBad=0
1 Like

Beautyful! Thank you!
I could try to squeeze a proper SWD header on v2.1 that I will complete once my homelab has moved to the new place. V2 is quite a bit bigger than v1 after all.
Donā€™t we use 128x64 on the standard T-beams? So 80x160 is actually more pixelsā€¦But in v2 luckily we can snap on any SPI display we like.
Great Job @geeksville and also @einzeln00 :heart_eyes:

2 Likes

Hi,

Great to hear that. You want a two row 10 pin ICE plug? in what pitch dimension? 2mm or 50mil( 1.27mm)?
I am busy in my new new job and flying back home in the weekends. and internet is not stable here, sorry for any delays.
Please work on the battery management first and lets valuate the feasibility for a minimum design. if the screen really bothersā€¦ what if use an LED blinking for monitoring node status?

2 Likes

Currently done reworking v2.0 to v2.1 and the only thing left on my list of bugs and enhancements is the swd header. I think Iā€™ll add a 50mil one. OK?

sounds good to me. btw: I should add sw support for your display sometime early next week.

2 Likes

Hi @geeksville,

finally i can build the branch on your Github account, which device in platformio.ini is for the board i sent you?
Would you please give me a hint?

1 Like

sure. For the boards you sent change ā€œdefault_envs = lora-relay-v1]ā€. It will build a hex fileā€¦ Also it will support uploading the file to the board via the ā€œuploadā€ option in platformio via a jlink board. Youā€™ll need to install the adafruit bootloader per the instructions in docs/hardware/corvus.md.

1 Like

Nice Iā€™m able to build it from the main branch without issues but currently Iā€™m fighting with the python script that uploads to the usb bootloader. Itā€™s not able to find the hex file. As soon as thereā€™s time Iā€™ll try to upload manually.
2.1 boards are ordered and new parts arrived. If it works, Kevin will get one of those :wink:

1 Like

Cool beans adding support for your screen is now next in my queue. Will probably do today or tomorrow.

2 Likes

I am having problem with flashing bootloader with a $2 swd dongleā€¦ I donā€™t have a solder at new home. too bad. I will need to get firmware running and testing RFā€¦

Progress. Though I still need to fix a bug when both the radio and the display are in use (both on the same SPI bus)

1 Like

@Corvus I dimly remember you mentioning the power supply was marginal for the T30 radio on the 1.1 board. Does this sound familar to you? I canā€™t find that comment now.

The reason I ask: With the screen on it seems like the board is browning out whenever I send a lora packet. My WIP here temporarily defines LORA_DISABLE_SENDING so I can have the (not optimized) screen and radio both kinda working.

1 Like

Actually the display and the nrf52 are on the 3.3v rail with nothing else and it can supply up to 600mA. The fat lora module has its own 5V rail with an overkill boost converter that can easily supply 2A. Not sure if this is a power issue. Maybe itā€™s RF interference, maybe via the ground plane? 1W is quite a lot for such a small board and the display is right underneath the E22. During my tests a nearby LED mains-powered lamp started to flicker during tx and sometimes USB would disconnect if it was connected to the device. Also, I noticed on the t-beams that with Meshtastic running, the transmit takes several seconds. Enough to disturb the display? :thinking:
On my 2.0 board i sometimes knocked out the lithium protection circuit during tx but only if I had the device in my hand, which might hint to rf interference. In 2.1 I installed ferrite beads here and there.
Iā€™ll try the code with the 22dbm version as soon as I have a minute left.
Great that you got the display working!

Edit: from the pic I see that youā€™re powering the thing from USBā€¦is your source able to provide enough current? It pulls 1.2A during TX from a lipo battery. Iā€™d recommend powering the thing from a good lithium cell with cables thick enough to handle 2A

1 Like

@geeksville OK, I installed your firmware on my small 22dbm board.
For some reason I have no access to my conda python3 environment from within platformio and also the ā€œpioā€ command doesnā€™t work. Luckily there are workarounds. (build button in GUI)
I was able to install dependencies, build and generate a uf2 file outside of Platformio running
(py3k) C:ā€¦\Meshtastic-esp32>python bin/uf2conv.py .pio/build/lora-relay-v1/firmware.hex -c -f 0xADA52840
The .uf2 could be easily drag-and-dropped on the mass storage device of the USB bootloader. The firmware runs, the bluetooth connectivity works well and the device produces a ton of log output on the USB serial port. It also transmits and does not crash. However, no communication with a t-beam running 0.9.1 taking place. And the display doesnā€™t work.
The thing is: I think I built and flashed the version without display support from https://github.com/geeksville/Meshtastic-esp32 This is a somewhat noobish question, but how can I git clone your latest version via the platformio command line (https://github.com/geeksville/Meshtastic-esp32/tree/corvus)?

Just for info purposes, here is what it outputs:

Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 1 online, 1 total
toRadioWriteCb data 0x20012d92, len 11
Trigger powerFSM 9
Client is setting owner
sending owner !eb491bf4d8c7/Art/A
Update DB node 0x1bf4d8c7, rx_time=0
old user !eb491bf4d8c7/Unknown d8c7/?C7
updating changed=1 user !eb491bf4d8c7/Art/A
Trigger powerFSM 8
Transition powerFSM transition=NodeDB update, from=ON to=ON
Node status update: 1 online, 1 total
Adding packet record (id=0x5851f434 Fr0xc7 To0xff, WantAck0, HopLim3 Payload:User)
enqueuing for send (id=0x5851f434 Fr0xc7 To0xff, WantAck0, HopLim3 encrypted)
txGood=2,rxGood=0,rxBad=0
Starting low level send (id=0x5851f434 Fr0xc7 To0xff, WantAck0, HopLim3 encrypted)
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 1 online, 1 total
Completed sending (id=0x5851f434 Fr0xc7 To0xff, WantAck0, HopLim3 encrypted)
toRadioWriteCb data 0x20015168, len 35
Trigger powerFSM 9
PACKET FROM PHONE (id=0xd851f43e Fr0xc7 To0xff, WantAck1, HopLim0 Payload:Data)
Ignoring incoming packet - not a position
Update DB node 0x1bf4d8c7, rx_time=0
Received text msg from=0x1bf4d8c7, id=-665717698, msg=nrf52
Trigger powerFSM 5
Transition powerFSM transition=Received text, from=ON to=ON
Node status update: 1 online, 1 total
Adding packet record (id=0xd851f43e Fr0xc7 To0xff, WantAck1, HopLim1 Payload:Data)
enqueuing for send (id=0xd851f43e Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
txGood=3,rxGood=0,rxBad=0
Starting low level send (id=0xd851f43e Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Completed sending (id=0xd851f43e Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 1 online, 1 total
toRadioWriteCb data 0x20015168, len 35
Trigger powerFSM 9
PACKET FROM PHONE (id=0xd851f43f Fr0xc7 To0xff, WantAck1, HopLim0 Payload:Data)
Ignoring incoming packet - not a position
Update DB node 0x1bf4d8c7, rx_time=0
Received text msg from=0x1bf4d8c7, id=-665717697, msg=nrf52
Trigger powerFSM 5
Transition powerFSM transition=Received text, from=ON to=ON
Node status update: 1 online, 1 total
Adding packet record (id=0xd851f43f Fr0xc7 To0xff, WantAck1, HopLim1 Payload:Data)
enqueuing for send (id=0xd851f43f Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
txGood=4,rxGood=0,rxBad=0
Starting low level send (id=0xd851f43f Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Completed sending (id=0xd851f43f Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Sending reliable retransmission fr=0x1bf4d8c7,to=0xffffffff,id=-665717698, tries left=2
Found existing packet record for fr=0x1bf4d8c7,to=0xffffffff,id=-665717698
enqueuing for send (id=0xd851f43e Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
txGood=5,rxGood=0,rxBad=0
Starting low level send (id=0xd851f43e Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Completed sending (id=0xd851f43e Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Sending reliable retransmission fr=0x1bf4d8c7,to=0xffffffff,id=-665717697, tries left=2
Found existing packet record for fr=0x1bf4d8c7,to=0xffffffff,id=-665717697
enqueuing for send (id=0xd851f43f Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
txGood=6,rxGood=0,rxBad=0
Starting low level send (id=0xd851f43f Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Sending reliable retransmission fr=0x1bf4d8c7,to=0xffffffff,id=-665717698, tries left=1
Found existing packet record for fr=0x1bf4d8c7,to=0xffffffff,id=-665717698
enqueuing for send (id=0xd851f43e Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
txGood=6,rxGood=0,rxBad=0
Can not send yet, busyTx
Completed sending (id=0xd851f43f Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Starting low level send (id=0xd851f43e Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Completed sending (id=0xd851f43e Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Sending reliable retransmission fr=0x1bf4d8c7,to=0xffffffff,id=-665717697, tries left=1
Found existing packet record for fr=0x1bf4d8c7,to=0xffffffff,id=-665717697
enqueuing for send (id=0xd851f43f Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
txGood=8,rxGood=0,rxBad=0
Starting low level send (id=0xd851f43f Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Reliable send failed, returning a nak fr=0x1bf4d8c7,to=0xffffffff,id=-665717698
Sending an ack=0x0,to=0x1bf4d8c7,idFrom=-665717698,id=1481765945
Enqueuing internal message for the receive queue
Adding packet record (id=0x5851f439 Fr0xc7 To0xc7, WantAck0, HopLim0 Payload:None failId=d851f43e)
FIXME not implementedReceived a nak=-665717698, stopping retransmissions
FIXME-update-db Sniffing packet
Delivering rx packet (id=0x5851f439 Fr0xc7 TpowerFSM 3
Ignoring incoming packet - not a position
Forwarding to phone (id=0x5851f439 Fr0xc7 To0xc7, WantAck0, HopLim0 Payload:None failId=d851f43e)
Update DB node 0x1bf4d8c7, rx_time=0
Telling client we have new packets 1
Telling client we have new packets 1
BLE notify fromNum
getFromRadio, state=6
encoding toPhone packet to phone variant=2, 28 bytes
Completed sending (id=0xd851f43f Fr0xc7 To0xff, WantAck0, HopLim1 encrypted)
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Reliable send failed, returning a nak fr=0x1bf4d8c7,to=0xffffffff,id=-665717697
Sending an ack=0x0,to=0x1bf4d8c7,idFrom=-665717697,id=1481765947
Enqueuing internal message for the receive queue
Adding packet record (id=0x5851f43b Fr0xc7 To0xc7, WantAck0, HopLim0 Payload:None failId=d851f43f)
FIXME not implementedReceived a nak=-665717697, stopping retransmissions
FIXME-update-db Sniffing packet
Delivering rx packet (id=0x5851f43b Fr0xc7 To0xc7, WantAck0, HopLim0 Payload:None failId=d851f43f)
Trigger powerFSM 3
Ignoring incoming packet - not a position
Forwarding to phone (id=0x5851f43b Fr0xc7 To0xc7, WantAck0, HopLim0 Payload:None failId=d851f43f)
Update DB node 0x1bf4d8c7, rx_time=0
Telling client we have new packets 2
Telling client we have new packets 2
BLE notify fromNum
getFromRadio, state=6
encoding toPhone packet to phone variant=2, 28 bytes
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Transition powerFSM transition=Screen-on timeout, from=ON to=DARK
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total
Update DB node 0x1bf4d8c7, rx_time=0
Node status update: 0 online, 1 total

re: not enough current via USB
OH! Duh! That totally makes sense. Based on your comment I just tried a bench supply set to 4V connected to the ā€œBATā€ and ā€œGNDā€ holes on the board. Are those the correct pins? I donā€™t see any current draw there though.

re: how to get to this development branch:

git clone https://github.com/geeksville/Meshtastic-esp32
cd Meshtastic-esp32
git checkout corvus
(then you can build/run with either the pio command line cmd or the IDE)
1 Like