Ok, I think I've gotten closer to it. Maybe somebody can tell me, why the Arduino that I'm trying to program doesn't reply at all.
I connected TX/RX on the "master" to RX/TX on the "slave", ground +5V obvious, CTS to ground and DTR to digital pin 4.
Here's my code:
#include <RedFly.h>
uint8_t serversock, sock;
void setup()
{
// virtual reset pin
pinMode(4, OUTPUT); // reset pin for arduino / DTR on FTDI header
digitalWrite(4, HIGH);
//init the WiFi module on the shield
/* wlan init is irrelevant => removed */
}
uint8_t buf[200];
int bp = 0;
bool resetDone = false;
void loop()
{
/* read data from WiFi to buf - removed for easier read */
RedFly.disable(); // disable WiFi card
Serial.begin(115200); // change baudrate to Arduino bootloader baudrate
// buffer pos != 0 -> data received
if (bp != 0)
{
if (!resetDone)
{
// reset slave before sending first data
digitalWrite(4, LOW);
delay(200);
digitalWrite(4, HIGH);
resetDone = true;
}
// print received buffer to boatloader
for (int i = 0; i < bp; i++)
Serial.print(buf[i], BYTE);
bp = 0;
// wait a bit for a reply
delay(100);
// read reply from bootloader
while (Serial.available())
buf[bp++] = Serial.read();
}
// change serial back to WiFi cards speed
Serial.begin(9600);
// enable wifi card
RedFly.enable();
// we received data from bootloader -> send it via WiFi
if (bp != 0)
RedFly.socketSend(sock, buf, bp);
// wait a bit for a reply
delay(100);
}
The data from WiFi (the first bytes from avrdude, namely 30 20) gets received and redirected at the right baudrate, I checked that. But the bootloader does not respond.
What am I doing wrong?
Thx for any help!
PS:
~ $ avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -q -q -patmega328p -carduino -Pnet:192.168.0.178:19999 -b115200 -D -Uflash:w:wlanprog.cpp.hex:i -vvvv
avrdude: Version 5.10, compiled on Jun 29 2010 at 21:09:48
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
User configuration file is "/home/emmo/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : net:192.168.0.178:19999
Using Programmer : arduino
Overriding Baud Rate : 115200
ioctl("TIOCMGET"): Invalid argument
ioctl("TIOCMGET"): Invalid argument
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
ioctl("TIOCMGET"): Invalid argument
PPS:
Master = Arduino Uno w/ RedFly shield
Slave = Arduino Ethernet