Post topics, source code that relate to the Arduino Platform

User avatar
By M0ebius
#1868 Not in its current state.
There is not much code - it is based on the 0.9.1 sdk (i dont have an official licence) and just some dirty hacking here and there.

Also, the settings are all hardcoded now - so everyone would need to change them, recompile and flash - which means you would need a working dev environment. I assume most people dont want to fiddle with that.

A clean solution would involve the possibility to configure the arduino boot server settings via AT commands and also their persistence.

For the upload tool, i could provide the code - it's in autohotkey cause i'm so lazy :)
(The current transfer method is a binary stream because of the full transparent mode - ascii format would be easier to handle - just punch out the hex file)
User avatar
By sistemasorp
#1975 I'm trying a new method based on KAVR bootloader http://bluecontroller.com/index.php?cid ... ~kavr_boot to program Arduino from the web. The idea is to modify KAVR bootloader for sending AT commands to the module. Then this bootloader will be burned onto ATMEL328P.

Arduino IDE:

Program your sketch and then verify/compile it. A .hex file will be created in temporary directory.

Web Server:

Copy that .hex file to a web server (internet or local) with a fixed name (i.e: sketch.hex).

Arduino Hardware:

The Arduino sketch is waiting for data in uart while it is doing some stuff. When it receives a magic packet, it will reset Arduino using watchdog trick.

The KAVR bootloader goes into action. Configure the ESP8266 to connect to a known web server, get into data mode and then query the .hex file, if KAVR find it, then each byte received is treated by KAVR as a byte from .hex file to reprogramming ATMEL328p.

The pro is you can program arduino remotely.

The con is you can not to program arduino from usb anymore. (Maybe if you clever modify the optiboot or arduino original bootloader).

As soon as I have the code tested I will publish it.
User avatar
By sistemasorp
#1998 Well, after a few work, i have decided to leave the last idea and try another theory:

Arduino IDE:

Program your sketch and then verify/compile it. A .hex file will be created in temporary directory.

Python:

Run a Python script that listens to a specific port. Then the script redirects the data from one client socket to the other and viceversa.

avrdude:

Execute avrdude to program arduino with -P net:<ip>:<port of python script>

Arduino hardware:

A transistor will communicate the reset pin to GND when the pin 12 is high. (a direct connection should not work due to AVR configures pins as LOW after a reset and it always should be resetting)

Arduino sketch

Do normal stuff. When serial has data and a magic packet is received:

Configure the module to the correct BAUD (depending your microcontroller, you can see upload.speed parameter in boards.txt):

AT+CIOBAUD=<board baud>

Reconfigure serial port with Serial.begin. Connect in "data mode":

AT+CIPMUX=0
AT+CIPMODE=1
AT+CIPSTART="TCP",<ip>,<port of python script>
AT+CIPSEND

Finally set pin 12 to HIGH to reset Arduino.

Explanation

First you run the python script. This is the source code: http://pastebin.com/abfnBQe2

Then you run avr-dude to connect to the python script (something like avrdude -p atmega328p -c arduino -P net:<ip>:<port> -U firmware.hex)

When magic packet is received by serial (or any other event), the Arduino configures the wi07c with the correct baud of the board (i.e: Arduino UNO is 115200), then a direct connection is established to the server with the running python script . Finally the transistor join reset pin with GND and a reset is performed.

At this point, both connections act as a tunnel between arduino bootloader and avrdude with pure data (The STK500 protocol).

With this you don't need to modify the original Arduino bootloader. However you will need the ESP8266 updated to the last firmware to change baud.

This afternoon I will test it and I will say you if it works.