If i had oscilloscope i'i'd find the reason in 1 hour but for casuallycasual engineering i don't need it. I've reported a bug to HM-10 manufacturer but i'm not sure when they fix it. HM-10 firmware version is v532.
If i had oscilloscope i' find the reason in 1 hour but for casually engineering i don't need it. I've reported a bug to HM-10 manufacturer but i'm not sure when they fix it.
If i had oscilloscope i'd find the reason in 1 hour but for casual engineering i don't need it. I've reported a bug to HM-10 manufacturer but i'm not sure when they fix it. HM-10 firmware version is v532.
Eventually i've found the reason. And it was bug in HM-10 firmware. In mode 0 it does not accept control commands and in modes 1 and 2 it accepts AT commands to control PIO and commands are look like 'AT+...', f.e. 'PIO set value 1 to pin 1' command is 'AT+PIO11' and change mode to 0 look like 'AT+MODE0'. I need mode 1 to set PIO to 1 and 0 to reset arduino board. The problem is that some of upload commands look like 'A [0x41] . [0x81] [0x20]' (starts from 'A' too) and it makes HM-10 think it's control command which also starts from 'A'. If i add changing mode to 0 after pin control commands (in order to make HM-10 stop accepting control commands) it starts uploading:
2015-09-18 10:27:32.144 xctest[94852:4603627] [TRACE ] [IN ]: Rx value received 9 bytes: O [0x4F] K [0x4B] + [0x2B] P [0x50] I [0x49] O [0x4F] 2 [0x32] : [0x3A] 1 [0x31]
2015-09-18 10:27:32.145 xctest[94852:4603627] [WARNING] [IN ]: Got 9 bytes in incoming buffer
2015-09-18 10:27:32.145 xctest[94852:4603627] [TRACE ] [IN ]: Rx value received 9 bytes: O [0x4F] K [0x4B] + [0x2B] P [0x50] I [0x49] O [0x4F] 2 [0x32] : [0x3A] 0 [0x30]
2015-09-18 10:27:32.146 xctest[94852:4603627] [WARNING] [IN ]: Got 9 bytes in incoming buffer
2015-09-18 10:27:32.146 xctest[94852:4603627] [TRACE ] [IN ]: Rx value received 8 bytes: O [0x4F] K [0x4B] + [0x2B] S [0x53] e [0x65] t [0x74] : [0x3A] 0 [0x30]
2015-09-18 10:27:32.147 xctest[94852:4603627] [WARNING] [IN ]: Got 8 bytes in incoming buffer
2015-09-18 10:27:32.147 xctest[94852:4603627] [TRACE ] [IN ]: Rx value received 1 bytes: . [0x00]
2015-09-18 10:27:32.147 xctest[94852:4603627] [TRACE ] [IN ]: Ignoring single 0x00 char
2015-09-18 10:27:32.207 xctest[94852:4603578] [TRACE ] [IN ]: Finish reading
2015-09-18 10:27:32.208 xctest[94852:4603578] [TRACE ] [IN ]: Ble clear buffer
2015-09-18 10:27:32.208 xctest[94852:4603578] [DEBUG ] [IN ]: Drained 26 bytes
2015-09-18 10:27:32.208 xctest[94852:4603578] [DEBUG ] [ ]: Draining incoming buffer (0 bytes)
2015-09-18 10:27:32.208 xctest[94852:4603578] [DEBUG ] [OUT]: Sending 2 bytes
2015-09-18 10:27:32.208 xctest[94852:4603578] [TRACE ] [OUT]: Send: 0 [0x30] [0x20]
2015-09-18 10:27:32.209 xctest[94852:4603578] [TRACE ] [OUT]: BLE sending bytes range from 0 length 2
2015-09-18 10:27:32.209 xctest[94852:4603578] [DEBUG ] [IN ]: Reading 1 bytes ...
2015-09-18 10:27:32.209 xctest[94852:4603578] [TRACE ] [IN ]: Start reading
2015-09-18 10:27:32.561 xctest[94852:4603630] [TRACE ] [IN ]: Rx value received 1 bytes: . [0x00]
2015-09-18 10:27:32.561 xctest[94852:4603630] [TRACE ] [IN ]: Ignoring single 0x00 char
2015-09-18 10:27:32.561 xctest[94852:4603627] [TRACE ] [IN ]: Rx value received 2 bytes: . [0x11] . [0xFC]
2015-09-18 10:27:32.561 xctest[94852:4603627] [WARNING] [IN ]: Got 2 bytes in incoming buffer
2015-09-18 10:27:32.563 xctest[94852:4603578] [TRACE ] [IN ]: Finish reading
2015-09-18 10:27:32.563 xctest[94852:4603578] [TRACE ] [IN ]: Receive: . [0x11]
2015-09-18 10:27:32.563 xctest[94852:4603578] [DEBUG ] [IN ]: Read 1 bytes, actually received 2 bytes
2015-09-18 10:27:32.563 xctest[94852:4603578] [TRACE ] [IN ]: 1 bytes in incoming buffer remaining for next receive
2015-09-18 10:27:32.563 xctest[94852:4603578] [ERROR ] [ ]: STK500:synchronize: attempt 1 of 3: no sync: received [0x11]
2015-09-18 10:27:32.564 xctest[94852:4603578] [DEBUG ] [ ]: Draining incoming buffer (1 bytes)
2015-09-18 10:27:32.564 xctest[94852:4603578] [DEBUG ] [OUT]: Sending 2 bytes
2015-09-18 10:27:32.564 xctest[94852:4603578] [TRACE ] [OUT]: Send: 0 [0x30] [0x20]
2015-09-18 10:27:32.564 xctest[94852:4603578] [TRACE ] [OUT]: BLE sending bytes range from 0 length 2
2015-09-18 10:27:32.565 xctest[94852:4603578] [DEBUG ] [IN ]: Reading 1 bytes ...
2015-09-18 10:27:32.565 xctest[94852:4603578] [TRACE ] [IN ]: Start reading
2015-09-18 10:27:32.636 xctest[94852:4603627] [TRACE ] [IN ]: Rx value received 1 bytes: . [0x00]
2015-09-18 10:27:32.636 xctest[94852:4603627] [TRACE ] [IN ]: Ignoring single 0x00 char
2015-09-18 10:27:32.636 xctest[94852:4603627] [TRACE ] [IN ]: Rx value received 2 bytes: . [0x14] . [0x10]
2015-09-18 10:27:32.636 xctest[94852:4603627] [WARNING] [IN ]: Got 2 bytes in incoming buffer
2015-09-18 10:27:32.638 xctest[94852:4603578] [TRACE ] [IN ]: Finish reading
2015-09-18 10:27:32.638 xctest[94852:4603578] [TRACE ] [IN ]: Receive: . [0x14]
2015-09-18 10:27:32.638 xctest[94852:4603578] [DEBUG ] [IN ]: Read 1 bytes, actually received 2 bytes
2015-09-18 10:27:32.638 xctest[94852:4603578] [TRACE ] [IN ]: 1 bytes in incoming buffer remaining for next receive
2015-09-18 10:27:32.639 xctest[94852:4603578] [DEBUG ] [IN ]: Reading 1 bytes ...
2015-09-18 10:27:32.639 xctest[94852:4603578] [TRACE ] [IN ]: Having current receive buffer: . [0x10]
2015-09-18 10:27:32.639 xctest[94852:4603578] [TRACE ] [IN ]: Start reading
2015-09-18 10:27:32.639 xctest[94852:4603578] [TRACE ] [IN ]: Finish reading
2015-09-18 10:27:32.640 xctest[94852:4603578] [TRACE ] [IN ]: Receive: . [0x10]
2015-09-18 10:27:32.644 xctest[94852:4603578] [DEBUG ] [IN ]: Read 1 bytes, actually received 1 bytes
2015-09-18 10:27:32.644 xctest[94852:4603578] [TRACE ] [IN ]: Ble clear buffer
2015-09-18 10:27:32.645 xctest[94852:4603578] [DEBUG ] [OUT]: Sending 3 bytes
2015-09-18 10:27:32.645 xctest[94852:4603578] [TRACE ] [OUT]: Send: A [0x41] . [0x81] [0x20]
2015-09-18 10:27:32.645 xctest[94852:4603578] [TRACE ] [OUT]: BLE sending bytes range from 0 length 3
2015-09-18 10:27:32.645 xctest[94852:4603578] [DEBUG ] [IN ]: Reading 1 bytes ...
2015-09-18 10:27:32.646 xctest[94852:4603578] [TRACE ] [IN ]: Start reading
2015-09-18 10:27:32.711 xctest[94852:4603630] [TRACE ] [IN ]: Rx value received 1 bytes: . [0x00]
2015-09-18 10:27:32.711 xctest[94852:4603630] [TRACE ] [IN ]: Ignoring single 0x00 char
2015-09-18 10:27:32.711 xctest[94852:4603630] [TRACE ] [IN ]: Rx value received 3 bytes: . [0x14] . [0x04] . [0x10]
2015-09-18 10:27:32.711 xctest[94852:4603630] [WARNING] [IN ]: Got 3 bytes in incoming buffer
2015-09-18 10:27:32.712 xctest[94852:4603578] [TRACE ] [IN ]: Finish reading
2015-09-18 10:27:32.713 xctest[94852:4603578] [TRACE ] [IN ]: Receive: . [0x14]
2015-09-18 10:27:32.713 xctest[94852:4603578] [DEBUG ] [IN ]: Read 1 bytes, actually received 3 bytes
2015-09-18 10:27:32.713 xctest[94852:4603578] [TRACE ] [IN ]: 2 bytes in incoming buffer remaining for next receive
2015-09-18 10:27:32.713 xctest[94852:4603578] [DEBUG ] [IN ]: Reading 1 bytes ...
2015-09-18 10:27:32.713 xctest[94852:4603578] [TRACE ] [IN ]: Having current receive buffer: . [0x04] . [0x10]
2015-09-18 10:27:32.714 xctest[94852:4603578] [TRACE ] [IN ]: Start reading
2015-09-18 10:27:32.714 xctest[94852:4603578] [TRACE ] [IN ]: Finish reading
2015-09-18 10:27:32.728 xctest[94852:4603578] [TRACE ] [IN ]: Receive: . [0x04]
2015-09-18 10:27:32.728 xctest[94852:4603578] [DEBUG ] [IN ]: Read 1 bytes, actually received 2 bytes
2015-09-18 10:27:32.729 xctest[94852:4603578] [TRACE ] [IN ]: 1 bytes in incoming buffer remaining for next receive
2015-09-18 10:27:32.729 xctest[94852:4603578] [DEBUG ] [IN ]: Reading 1 bytes ...
2015-09-18 10:27:32.729 xctest[94852:4603578] [TRACE ] [IN ]: Having current receive buffer: . [0x10]
2015-09-18 10:27:32.729 xctest[94852:4603578] [TRACE ] [IN ]: Start reading
2015-09-18 10:27:32.730 xctest[94852:4603578] [TRACE ] [IN ]: Finish reading
2015-09-18 10:27:32.730 xctest[94852:4603578] [TRACE ] [IN ]: Receive: . [0x10]
2015-09-18 10:27:32.730 xctest[94852:4603578] [DEBUG ] [IN ]: Read 1 bytes, actually received 1 bytes
2015-09-18 10:27:32.730 xctest[94852:4603578] [TRACE ] [IN ]: Ble clear buffer
2015-09-18 10:27:32.731 xctest[94852:4603578] [DEBUG ] [OUT]: Sending 3 bytes
2015-09-18 10:27:32.731 xctest[94852:4603578] [TRACE ] [OUT]: Send: A [0x41] . [0x82] [0x20]
2015-09-18 10:27:32.731 xctest[94852:4603578] [TRACE ] [OUT]: BLE sending bytes range from 0 length 3
2015-09-18 10:27:32.732 xctest[94852:4603578] [DEBUG ] [IN ]: Reading 1 bytes ...
2015-09-18 10:27:32.732 xctest[94852:4603578] [TRACE ] [IN ]: Start reading
2015-09-18 10:27:32.786 xctest[94852:4603627] [TRACE ] [IN ]: Rx value received 1 bytes: . [0x00]
2015-09-18 10:27:32.786 xctest[94852:4603627] [TRACE ] [IN ]: Ignoring single 0x00 char
2015-09-18 10:27:32.787 xctest[94852:4603627] [TRACE ] [IN ]: Rx value received 3 bytes: . [0x14] . [0x04] . [0x10]
2015-09-18 10:27:32.787 xctest[94852:4603627] [WARNING] [IN ]: Got 3 bytes in incoming buffer
2015-09-18 10:27:32.788 xctest[94852:4603578] [TRACE ] [IN ]: Finish reading
2015-09-18 10:27:32.788 xctest[94
I was working for Mega2560 since it uses different bootloader and upload commands do not start from 'A'. It's definitely HM-10 firmware bug as it can understand it's not control command since the second byte is not 'T'.
If i had oscilloscope i' find the reason in 1 hour but for casually engineering i don't need it. I've reported a bug to HM-10 manufacturer but i'm not sure when they fix it.