Author Topic: [SOLVED] OakRestore with Bus Pirate on Mac OS X?  (Read 3367 times)

chad

  • Newbie
  • *
  • Posts: 7
[SOLVED] OakRestore with Bus Pirate on Mac OS X?
« on: March 28, 2016, 07:11:40 pm »
Hi all,

Is it possible to run the OakRestore python script using a BusPirate as the UART to USB connection? I'm not having luck with it. I've got it all wired up correctly afaik, but when running the esptool.py script as stated in the OakRestore README.md, I end up with:

Quote
A fatal error occurred: Failed to connect to ESP8266

I do see output in the BP UART console so something is connecting but I've not been successful in my attempts at restoration.

If you need more info like how I'm setting up BP, what connections I'm making, how I'm using the terminals, etc... let me know and I'll post more. I'm just wondering if someone has used BP to successfully as a UART to USB for OakRestore and what I'm missing in my secret sauce here!

Thanks!
« Last Edit: March 29, 2016, 09:56:45 am by chad »

emardee

  • Full Member
  • ***
  • Posts: 135
Re: OakRestore with BusPirate?
« Reply #1 on: March 28, 2016, 10:36:50 pm »
Have you seen the articles in the wiki?

Connecting Serial via Bys Pirate:
http://digistump.com/wiki/oak/tutorials/serial

and

Restoring Firmware over Serial:
http://digistump.com/wiki/oak/tutorials/serialfirmware

and using Arduino to restore firmware:
http://digistump.com/wiki/oak/tutorials/serial_through_arduino

Hopefully between those articles you might find what you are looking for.

Apologies if you've already seen them, and still having problems.

Mike

chad

  • Newbie
  • *
  • Posts: 7
Re: OakRestore with Bus Pirate?
« Reply #2 on: March 29, 2016, 08:43:00 am »
Thanks for the links @emardee! Those are the very same pages I've used to hobble together what I'm doing but I appreciate you linking them anyway. Here's a run down of what I've done (this is all on a Mac but I've also tried it, with the same failure, on Ubuntu):

Wire-up:
Oak GND to UART GND
Oak P3/RX to UART TX
Oak P4/TX to UART RX
Oak P2 to GND

Put Bus Pirate in UART mode:
Code: [Select]
sudo screen /dev/cu.usbserial-******** 115200 8N1
# (******** is my Bus Pirate serial number)
In BP prompt:
m -> 3 -> 9 -> 1 -> 1 -> 1 -> 2
In UART prompt (transparent bridge):
(1)

Run OakRestore tool (in a different terminal window):
Code: [Select]
sudo python esptool.py --baud 115200 --port /dev/cu.usbserial-******** write_flash -fs 32m 0x1000 blank.bin 0x2000 oaksetup_restore.bin 0x0081000 oakupdate_restore.bin 0x101000 blank.bin 0x102000 blank.bin 0x202000 blank.bin
# (******** is my Bus Pirate serial number)

esptool.py output:
Code: [Select]
Connecting...

A fatal error occurred: Failed to connect to ESP8266

UART console output:
Code: [Select]
sll��|�l�|�$�b|����;�#�b��nn�$nn���cpp$clsl��B���h�I�@�p����h�I�@�p����h�I�@�p����h�I��p���ВI�@�p���В�@�p���ВI�@�p���h��@�`��b���h�I�@�p����h�I�@�p����h�I�@�p����h�I��p����h��@�p���В�@�p���ВI�@��h�I�@��B���h�I�@�p����h�I�@�p����h�I�@�p����h�I��p�Ā�p�I�@�`�Ā�В�@�p���ВI�@��h�I�@�`�Ā��h�I�@�p����h�I�@�p����h�I�@�p����h�I�@�p����h��@�p���В�@�p���ВI�@��h�I�@p��Ð�@��B��h�I�@�p����h�I�@�p����h�I�@�p����h��@�p���ВI�@����h��@�p���В�@�`�Ā��h�I�@�p����h�I�@�p����h�I�@�p����h�I�@�p����h��@�p���В�@�p���ВI�@��h�I�@�`�Ā��h�I�@�p����h�I�@�p����h�I�@�p����h�I�@�p����h��@�p���В�@�p���ВI�@��h�I�@�I�@�p����h�I�@�p����h�I�@�p����h�I��p����h��@�p���В�@�p���ВI�@��h�I�@�`�Ā��h�I�@�p����h�I�@�p����h�I�@�p����h�I�@�p���ВI�@�p���В�@�p���ВI�@�p���h��@��B��h�I�@�p����h�I�@�p����h�I�@�p����h�I��p���ВI�@�p���В�@�p���ВI�@�p���h��@�`�Ā��h�I�@�p����h�I�@�p����h�I�@�p����h�I�@�p����h��@�p���В�@�p���ВI�@��h�I�@�p����h�I�@�p����h�I�@�p����h�I�@�p����h�I�@�p���ВI�@�p���В�@�p���ВI�@�p���h��@�`�Ā��h�I�@�p����h�I�@�p����h�I�@�p����h�I�@�p����h��@�p���В�@�p���ВI�@��h�I�@��B���h�I�@�p����h�I�@�p����h�I�@�p����h�I��p���ВI�@�p���В�@�p���ВI�@��h�I�@�p�Ā��h�I�@�p����h�I�@�p����h�I�@�p����h�I�@�p���ВI�@�p���В�@�p���ВI�@�p���h��@
If anyone has any tips or insight, I'm all ears! :)
« Last Edit: March 29, 2016, 08:45:39 am by chad »

chad

  • Newbie
  • *
  • Posts: 7
Re: [SOLVED] OakRestore with Bus Pirate on Mac OS X?
« Reply #3 on: March 29, 2016, 10:05:20 am »
I figured it out!!  :D

Seems killing the screen session doesn't properly disconnect. After putting the UART into transparent bridge mode you must explicitly quit screen by issuing:
Code: [Select]
Ctrl-A
Ctrl-\

Alternative to using 'screen' to connect to Bus Pirate, you can use 'cu' as well.
Code: [Select]
sudo cu -l /dev/cu.usbserial-******** -s 115200
# (******** is the Bus Pirate serial number)
When using 'cu' it will get a hangup signal as soon as esptool.py starts up so you don't need to manually disconnect or quit.

Then the correct output of esptool.py will be:
Code: [Select]
Connecting...
Erasing flash...
Wrote 4096 bytes at 0x00001000 in 0.4 seconds (78.8 kbit/s)...
Erasing flash...
Wrote 271360 bytes at 0x00002000 in 29.7 seconds (73.2 kbit/s)...
Erasing flash...
Wrote 259072 bytes at 0x00081000 in 28.3 seconds (73.2 kbit/s)...
Erasing flash...
Wrote 4096 bytes at 0x00101000 in 0.4 seconds (82.0 kbit/s)...
Erasing flash...
Wrote 4096 bytes at 0x00102000 in 0.4 seconds (78.8 kbit/s)...
Erasing flash...
Wrote 4096 bytes at 0x00202000 in 0.4 seconds (82.0 kbit/s)...

Leaving...

So, in summary, the steps in my second reply work, provided you hit "Ctrl-A" then "Ctrl-\" to quit screen after putting BP in UART transparent bridge mode.

Since this is specific to Mac, I've edited the title of the thread.
« Last Edit: March 29, 2016, 10:32:45 am by chad »