Author Topic: [Update] RFM69 Library for ESP8266 - Moteino Compatible!  (Read 50712 times)

jra

  • Jr. Member
  • **
  • Posts: 81
  • Country: us
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #15 on: March 11, 2016, 12:10:02 PM »
@joelucid it's not just the documentation, using the SDK itself can be a bit, um, challenging. One can only hope that Espressif applies some of the lessons learned with the ESP8266 to the ESP32 whenever it goes to production.

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #16 on: March 12, 2016, 05:58:36 AM »
Yeah - it does have its challenges. It took some time to even find a way to reliably flash from the mac. Any bitrate higher than 115200 often ended in corrupted flash - without error message of course, it just wouldn't boot. And the Arduino IDE was dog slow and insisted on essentially always rebuilding everything.

I now build using make with makeEspArduino.mk and deploy with espota.py and this seems to be a pretty reasonable setup. Compiles are very fast. Uploads take around 15-20s giving me bearable turnaround times.

The radio code works fine and I now also have my bootserver code partially ported. Takes under a second to push a binary 328p image to the bootserver via curl/wifi and less than 2s to transfer a 18k image to a Moteino. Not too bad.

executivul

  • NewMember
  • *
  • Posts: 48
  • Country: ro
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #17 on: March 12, 2016, 06:13:10 AM »
So we can now see some of your bootloader code joe? (I keep bugging you, sorry about that, but you asked for it ;) )

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #18 on: March 12, 2016, 06:16:04 AM »
Quote
So we can now see some of your bootloader code joe? (I keep bugging you, sorry about that, but you asked for it ;) )

While I'm working on it no need to bug me  ;)

executivul

  • NewMember
  • *
  • Posts: 48
  • Country: ro
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #19 on: March 12, 2016, 06:21:31 AM »
Ssshhh I keep quiet than :P
My ESP8266 is still on the airplane from China, hope to be here in time.
Good luck with the coding!

jra

  • Jr. Member
  • **
  • Posts: 81
  • Country: us
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #20 on: March 12, 2016, 09:01:18 AM »
+1 using makeEspArduino.mk instead of the Arduino IDE, there is also https://github.com/sudar/Arduino-Makefile.git for AVR-based boards.  I made two small local changes to make my life a lot easier (on linux, might work on OSX, don't know about Windows).  First I removed the hardwired ck upload option and made it a variable so the makefile works with a variety of boards

Code: [Select]
#
# UPLOAD_BOARD choices are none|ck|wifio|nodemcu
#
UPLOAD_BOARD ?= ck
...
upload: all
        $(ESP_TOOL) $(UPLOAD_VERB) -cd $(UPLOAD_BOARD) -cb $(UPLOAD_SPEED) -cp $(UPLOAD_PORT) -ca 0x00000 -cf $(MAIN_EXE)

Second is I determine the appropriate USB port dynamically:

Code: [Select]
UPLOAD_PORT ?= $(shell lastusb)

Here is the lastusb script.  This is the part that is linux specific for now:

Code: [Select]
#!/bin/bash
ls -1tr /dev/ttyUSB* | tail -1

I tend to have lots of Moteinos, Arduinos, ESP8266's and STM32's all plugged in at once.  Keeping track of which was associated with which USB port was a real headache until Steve Childress pointed me to a powered USB hub with switchable ports.  This is the one I've been using, I'm sure there are others that work just as well http://www.amazon.com/gp/product/B007WTHGL8 . When you want to upload to a particular device just toggle the associated switch, wait a couple of seconds for udev to do its thing and run "make upload" to upload to the most recently power cycled device.  One of the biggest timesavers I've found.

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #21 on: March 12, 2016, 11:01:14 AM »
Keeping track of which was associated with which USB port was a real headache until Steve Childress pointed me to a powered USB hub with switchable ports.  This is the one I've been using, I'm sure there are others that work just as well http://www.amazon.com/gp/product/B007WTHGL8 . When you want to upload to a particular device just toggle the associated switch, wait a couple of seconds for udev to do its thing and run "make upload" to upload to the most recently power cycled device.  One of the biggest timesavers I've found.
Whoa! That's a cool thing!  Thanks for posting!
Tom

jra

  • Jr. Member
  • **
  • Posts: 81
  • Country: us
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #22 on: March 12, 2016, 11:29:49 AM »
Forgot to mention that if you are using a Moteino or other Arduino with built-in USB that implements a modem interface the following should work with those devices as well:

Code: [Select]
#!/bin/bash
ls -1tr /dev/tty{ACM,USB}* 2>/dev/null | tail -1

someburner

  • NewMember
  • *
  • Posts: 13
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #23 on: March 12, 2016, 05:38:30 PM »
On the note of multiple FTDI devices, I generally have an ESP8266 and Moteino hooked up at the same time. I made some documentation for symbolically linking a given FTDI adapter to a chosen name in Linux. So whenever I use /dev/ftdi_esp or /dev/ftdi_uno it always goes to the right spot regardless of what port its on. This is good if you have 2+ FTDI devices and can dedicate each to a certain type of device.

Also if you're on Linux I highly recommend using Atom and installing the platformio addon. Build and upload to an attached Moteino is as easy as Cmd+Shift+B and Cmd+Shift+U

Also if people are looking for more resources for an Esp8266 Arduino programmer, check out the Esp-link project. https://github.com/jeelabs/esp-link

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #24 on: March 12, 2016, 10:05:28 PM »
Forgot to mention that if you are using a Moteino or other Arduino with built-in USB that implements a modem interface the following should work with those devices as well:

Code: [Select]
#!/bin/bash
ls -1tr /dev/tty{ACM,USB}* 2>/dev/null | tail -1
I tried that on my Windows 7 system and all it said was "Huh?".  ;)

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #25 on: March 12, 2016, 10:59:44 PM »

Also if you're on Linux I highly recommend using Atom....


Are you referring to Atom the text editor (https://atom.io/ )?

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #26 on: March 13, 2016, 01:46:42 AM »
Quote
Also if people are looking for more resources for an Esp8266 Arduino programmer, check out the Esp-link project. https://github.com/jeelabs/esp-link

Thanks for the link, that's an interesting project.

Quote
. I made some documentation for symbolically linking a given FTDI adapter to a chosen name in Linux. So whenever I use /dev/ftdi_esp or /dev/ftdi_uno it always goes to the right spot regardless of what port its on. This is good if you have 2+ FTDI devices and can dedicate each to a certain type of device.

On the Mac you can configure the FTDI driver to use fixed names as well as alias lower bitrates to higher ones. I use this (https://spin.atomicobject.com/2013/06/23/baud-rates-ftdi-driver-mac/) to alias 300baud to 1Mbaud and it works ok. In general though the ftdi driver is pretty unstable on the Mac.

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #27 on: March 13, 2016, 01:48:45 AM »
Quote
Also if you're on Linux I highly recommend using Atom and installing the platformio addon. Build and upload to an attached Moteino is as easy as Cmd+Shift+B and Cmd+Shift+U

I never feel quite at home until I can compile from emacs using a makefile. All that muscle memory at work  ;)

someburner

  • NewMember
  • *
  • Posts: 13
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #28 on: March 15, 2016, 06:33:04 PM »
Are you referring to Atom the text editor (https://atom.io/ )?

Yup! The plugins are awesome. Mainly the platformio integration I mentioned and the built-in git integration. If your project uses git it highlights which files have been modified since the last commit. There's also shortcuts for all the git commands but I prefer to take care of that stuff in terminal. For web stuff I still prefer Brackets.

thebillplease

  • NewMember
  • *
  • Posts: 2
  • Country: us
Re: [Update] RFM69 Library for ESP8266 - Moteino Compatible!
« Reply #29 on: March 25, 2016, 04:00:43 PM »
@joelucid, this is awesome! I've been looking for this all over! Do you happen to have the sketches you used to make it work? Any help is much appreciated it.