1

I'm working on wireless uploader for Arduino from iOS devices. I'm using HM-10 BLE module which seems to work ok. PIO 2 is used as DTR for resetting (see A [0x41] T [0x54] + [0x2B] P [0x50] I [0x49] O [0x4F] 2 [0x32] 1 [0x31] and A [0x41] T [0x54] + [0x2B] P [0x50] I [0x49] O [0x4F] 2 [0x32] 0 [0x30] below)- using 0.1uF capacitor and 10K resistor wired to MCU reset pin. Reset seems to be done correctly as i'm getting ready output (in 'setup()' body in uploaded sketch).

For some reason i'm getting 0x14 0x10 for 0x30 0x20 request (to ping bootloader) but not getting response for A [0x41] . [0x81] [0x20] within almost 1 second.

Uploading over BLE:

2015-07-04 19:24:10.955 xctest[54864:5122867] [TRACE  ] [OUT]: Send: A [0x41] T [0x54] + [0x2B] P [0x50] I [0x49] O [0x4F] 2 [0x32] 1 [0x31] 
2015-07-04 19:24:10.955 xctest[54864:5122867] [TRACE  ] [OUT]: BLE sending bytes range from 0 length 8
2015-07-04 19:24:11.106 xctest[54864:5122867] [DEBUG  ] [OUT]: Sending 8 bytes
2015-07-04 19:24:11.106 xctest[54864:5122867] [TRACE  ] [OUT]: Send: A [0x41] T [0x54] + [0x2B] P [0x50] I [0x49] O [0x4F] 2 [0x32] 0 [0x30] 
2015-07-04 19:24:11.106 xctest[54864:5122867] [TRACE  ] [OUT]: BLE sending bytes range from 0 length 8
2015-07-04 19:24:11.148 xctest[54864:5122867] [DEBUG  ] [   ]: Draining for 230 ms ...
2015-07-04 19:24:11.148 xctest[54864:5122867] [TRACE  ] [IN ]: Start reading
2015-07-04 19:24:11.323 xctest[54864:5122903] [TRACE  ] [IN ]: Rx value received 9 bytes: O [0x4F] K [0x4B] + [0x2B] P [0x50] I [0x49] O [0x4F] 2 [0x32] : [0x3A] 1 [0x31] 
2015-07-04 19:24:11.323 xctest[54864:5122903] [TRACE  ] [IN ]: Rx value received 9 bytes: O [0x4F] K [0x4B] + [0x2B] P [0x50] I [0x49] O [0x4F] 2 [0x32] : [0x3A] 0 [0x30] 
2015-07-04 19:24:11.381 xctest[54864:5122867] [TRACE  ] [IN ]: Finish reading
2015-07-04 19:24:11.381 xctest[54864:5122867] [TRACE  ] [IN ]: Ble clear buffer
2015-07-04 19:24:11.381 xctest[54864:5122867] [DEBUG  ] [IN ]: Drained 18 bytes
2015-07-04 19:24:11.381 xctest[54864:5122867] [DEBUG  ] [OUT]: Sending 2 bytes
2015-07-04 19:24:11.381 xctest[54864:5122867] [TRACE  ] [OUT]: Send: 0 [0x30]   [0x20] 
2015-07-04 19:24:11.382 xctest[54864:5122867] [TRACE  ] [OUT]: BLE sending bytes range from 0 length 2
2015-07-04 19:24:11.382 xctest[54864:5122867] [DEBUG  ] [IN ]: Reading 1 bytes ...
2015-07-04 19:24:11.382 xctest[54864:5122867] [TRACE  ] [IN ]: Start reading
2015-07-04 19:24:11.746 xctest[54864:5122914] [TRACE  ] [IN ]: Rx value received 1 bytes: . [0x00] 
2015-07-04 19:24:11.747 xctest[54864:5122914] [TRACE  ] [IN ]: Ignoring single 0x00 char 
2015-07-04 19:24:11.747 xctest[54864:5122914] [TRACE  ] [IN ]: Rx value received 2 bytes: . [0x14] . [0x10] 
2015-07-04 19:24:11.748 xctest[54864:5122867] [TRACE  ] [IN ]: Finish reading
2015-07-04 19:24:11.748 xctest[54864:5122867] [TRACE  ] [IN ]: Receive: . [0x14] 
2015-07-04 19:24:11.749 xctest[54864:5122867] [DEBUG  ] [IN ]: Read 1 bytes, actually received 2 bytes
2015-07-04 19:24:11.749 xctest[54864:5122867] [TRACE  ] [IN ]: 1 bytes in incoming buffer remaining for next receive
2015-07-04 19:24:11.749 xctest[54864:5122867] [DEBUG  ] [IN ]: Reading 1 bytes ...
2015-07-04 19:24:11.750 xctest[54864:5122867] [TRACE  ] [IN ]: Having current receive buffer: . [0x10] 
2015-07-04 19:24:11.750 xctest[54864:5122867] [TRACE  ] [IN ]: Start reading
2015-07-04 19:24:11.750 xctest[54864:5122867] [TRACE  ] [IN ]: Finish reading
2015-07-04 19:24:11.751 xctest[54864:5122867] [TRACE  ] [IN ]: Receive: . [0x10] 
2015-07-04 19:24:11.751 xctest[54864:5122867] [DEBUG  ] [IN ]: Read 1 bytes, actually received 1 bytes
2015-07-04 19:24:11.751 xctest[54864:5122867] [TRACE  ] [IN ]: Ble clear buffer
2015-07-04 19:24:11.752 xctest[54864:5122867] [DEBUG  ] [OUT]: Sending 3 bytes
2015-07-04 19:24:11.752 xctest[54864:5122867] [TRACE  ] [OUT]: Send: A [0x41] . [0x81]   [0x20] 
2015-07-04 19:24:11.752 xctest[54864:5122867] [TRACE  ] [OUT]: BLE sending bytes range from 0 length 3
2015-07-04 19:24:11.752 xctest[54864:5122867] [DEBUG  ] [IN ]: Reading 1 bytes ...
2015-07-04 19:24:11.753 xctest[54864:5122867] [TRACE  ] [IN ]: Start reading
2015-07-04 19:24:11.821 xctest[54864:5122914] [TRACE  ] [IN ]: Rx value received 1 bytes: . [0x00] 
2015-07-04 19:24:11.821 xctest[54864:5122914] [TRACE  ] [IN ]: Ignoring single 0x00 char 
2015-07-04 19:24:12.721 xctest[54864:5122903] [TRACE  ] [IN ]: Rx value received 5 bytes: r [0x72] e [0x65] a [0x61] d [0x64] y [0x79] 
2015-07-04 19:24:12.722 xctest[54864:5122867] [TRACE  ] [IN ]: Finish reading
2015-07-04 19:24:12.722 xctest[54864:5122867] [TRACE  ] [IN ]: Receive: r [0x72] 
2015-07-04 19:24:12.723 xctest[54864:5122867] [DEBUG  ] [IN ]: Read 1 bytes, actually received 5 bytes
2015-07-04 19:24:12.723 xctest[54864:5122867] [TRACE  ] [IN ]: 4 bytes in incoming buffer remaining for next receive
2015-07-04 19:24:12.723 xctest[54864:5122867] [ERROR  ] [   ]: STK500:getParameter: protocol error #1, expected [0x14], received [0x72]

When uploading over usb it's ok:

2015-06-29 16:34:10.829 xctest[36585:3703900] [TRACE  ] [   ]: DTR/RTS supported by Serial, resetting
2015-06-29 16:34:11.140 xctest[36585:3703900] [DEBUG  ] [IN ]: Draining ...
2015-06-29 16:34:11.392 xctest[36585:3703900] [DEBUG  ] [IN ]: Drain done
2015-06-29 16:34:11.392 xctest[36585:3703900] [DEBUG  ] [OUT]: Sending 2 bytes
2015-06-29 16:34:11.392 xctest[36585:3703900] [TRACE  ] [OUT]: Send: 0 [0x30]   [0x20] 
2015-06-29 16:34:11.393 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.531 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x14] 
2015-06-29 16:34:11.531 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.532 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x10] 
2015-06-29 16:34:11.532 xctest[36585:3703900] [DEBUG  ] [OUT]: Sending 3 bytes
2015-06-29 16:34:11.532 xctest[36585:3703900] [TRACE  ] [OUT]: Send: A [0x41] . [0x81]   [0x20] 
2015-06-29 16:34:11.533 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.535 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x14] 
2015-06-29 16:34:11.536 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.536 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x04] 
2015-06-29 16:34:11.536 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.536 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x10] 
2015-06-29 16:34:11.537 xctest[36585:3703900] [DEBUG  ] [OUT]: Sending 3 bytes
2015-06-29 16:34:11.537 xctest[36585:3703900] [TRACE  ] [OUT]: Send: A [0x41] . [0x82]   [0x20] 
2015-06-29 16:34:11.537 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.540 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x14] 
2015-06-29 16:34:11.540 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.540 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x04] 
2015-06-29 16:34:11.540 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.541 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x10] 
2015-06-29 16:34:11.541 xctest[36585:3703900] [DEBUG  ] [   ]: STK500:initialize: n_extparms = 4
2015-06-29 16:34:11.541 xctest[36585:3703900] [DEBUG  ] [OUT]: Sending 22 bytes
2015-06-29 16:34:11.542 xctest[36585:3703900] [TRACE  ] [OUT]: Send: B [0x42] . [0x86] . [0x00] . [0x01] . [0x00] . [0x01] . [0x01] . [0x01] . [0x03] . [0xFF] . [0xFF] . [0xFF] . [0xFF] . [0x00] . [0x80] . [0x04] . [0x00] . [0x00] . [0x00] . [0x80] . [0x00]   [0x20] 
2015-06-29 16:34:11.542 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.548 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x14] 
2015-06-29 16:34:11.548 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.548 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x10] 
2015-06-29 16:34:11.548 xctest[36585:3703900] [DEBUG  ] [OUT]: Sending 7 bytes
2015-06-29 16:34:11.549 xctest[36585:3703900] [TRACE  ] [OUT]: Send: E [0x45] . [0x05] . [0x04] . [0xD7] . [0xC2] . [0x00]   [0x20] 
2015-06-29 16:34:11.549 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.552 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x14] 
2015-06-29 16:34:11.552 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.552 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x10] 
2015-06-29 16:34:11.553 xctest[36585:3703900] [DEBUG  ] [OUT]: Sending 2 bytes
2015-06-29 16:34:11.553 xctest[36585:3703900] [TRACE  ] [OUT]: Send: P [0x50]   [0x20] 
2015-06-29 16:34:11.553 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.556 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x14] 
2015-06-29 16:34:11.556 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 1 bytes
2015-06-29 16:34:11.556 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x10] 
2015-06-29 16:34:11.569 xctest[36585:3703900] Reading |                                                    | 0% 0ms
2015-06-29 16:34:11.570 xctest[36585:3703900] [DEBUG  ] [OUT]: Sending 2 bytes
2015-06-29 16:34:11.571 xctest[36585:3703900] [TRACE  ] [OUT]: Send: u [0x75]   [0x20] 
2015-06-29 16:34:11.571 xctest[36585:3703900] [DEBUG  ] [IN ]: Receiving 5 bytes
2015-06-29 16:34:11.572 xctest[36585:3703900] [TRACE  ] [IN ]: Received: . [0x14] . [0x1E] . [0x95] . [0x0F] . [0x10] 
2015-06-29 16:34:11.572 xctest[36585:3703900] Reading | ################################################## | 100% 2ms

So when uploading over USB DTR/RTS and similar schematic is used.

I think the problem is in resetting approach - wiring to reset does not work when trying to upload. Am i right? Is it bootloader issue?

PS. Arduino sketch uploaded:

void setup() {
  Serial.begin(115200);
  Serial.print("ready");

  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
}

void loop() {
  // put your main code here, to run repeatedly:

}
  • I forgot to say i've tested with Arduino Uno r3. i've just tested uploading to Arduino Mega2560 and it works - Mega's bootloader replies as expected and uploading succeed. What's wrong with Uno? – 4ntoine Jul 5 '15 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.