Tapatalk

Arduino MEGA as USB-Serial problem

Arduino MEGA as USB-Serial problem

3

PostJan 27, 2017#1

Hi,

I use arduino MEGA as usb-serial converter connecting GND-RESET together and PIN0+PIN1 as TX(RX) to whisper node communications pins (and GND,VCC). In Arduino IDE I set "Talk2 Whisper Node" as kit a and proper USB port. Next I open serial monitor console set 115200bauds and upload simple program. Diode on Whisper Node blink quickly (yellow), but on the status bar of IDE I found this error messages :

Code: Select all

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x0d
on the serial console I saw output from Whisper Node, but 15 times.

I mean that communication works, but I can't upload any code. Why ?

Code: Select all

============================================
 T A L K 2   W H I S P E R   N O D E   0.3v
============================================

    Major Version: 1
    Minor Version: 4
     Running Mode: Client

## Configuration ##

  :: SPI Flash ::
         JEDEC ID: EF3013
        Unique ID: D7:65:A4:5:83:81:36:29:
 Write Protection: 100

  :: Radio RFM69 ::
       Frequency: 916.0000000000MHz
        TX Power: 14dBm
  Encryption Key: 0:1:2:3:4:5:6:7:8:9:A:B:C:D:E:F:

  :: Supply Voltages ::
          Battery: 14mV
    Micro-USB/VIN: 4947mV

  :: Talk2 Bootloader ::
    Major Version: 2
    Minor Version: 1
      EEPROM Data: 54:6C:6B:B2:1:A:0:7:0:0:0:0:0:0:11:A:0:0:1:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:

============================================

1885
1885

PostJan 27, 2017#2

Hi Vogll,

The program is happening because you also need to control the Reset pin, normally done by the DTR/RTS pin. The Serial Upload is only possible during the start-up as the bootloader running on the MCU waits a few milliseconds for commands on the serial port from the Arduino IDE.

If the MCU is already running, nothing will happen as the data will "hit" the main program. To use an Arduino Uno as USB to Serial adapter the ideal is to remove the chip from the board and connect TX, RX as you mentioned, but also connect the Reset from the Arduino board to the DTR/RTS pin, so the USB-to-Serial will be able to send the "reset" command before start uploading the code.

In case of the Arduino Mega, you can't remove the chip, so you might not be able to use it to program the Whisper Node over serial. The only option if you only have the Arduino Mega would be to use it as an ISP programmer and upload your code using the ISP headers, but the easiest option might be get an USB-to-Serial adapter, just search for FTDI adapter on eBay or other electronic shop.

Regards,

3

PostJan 27, 2017#3

Talk2 wrote:Hi Vogll,
In case of the Arduino Mega, you can't remove the chip, so you might not be able to use it to program the Whisper Node over serial. The only option if you only have the Arduino Mega would be to use it as an ISP programmer and upload your code using the ISP headers, but the easiest option might be get an USB-to-Serial adapter, just search for FTDI adapter on eBay or other electronic shop.
Thank you for reply,

I buy serial converter, but I get it after 20 days :-(. You wrote that I can use ISP header, can you explain how to connect it to Whisper Node ?

1885
1885

PostFeb 05, 2017#4

Hi again vogll,

Sorry I only see your last post now. I did try here using an Arduino Uno board and was able to program it via Serial without removing the chip, which is the case when you have an Arduino Mega. The trick is to "reset" the Whisper Node manually during the sketch upload.

The preparing steps are the following:

1. Disable the MEGA by connecting the RESET Pin on Mega to Ground. This will disable the MEGA MCU and you can now hijack the USB-to-Serial adapter.
2. Connect the Mega Serial Pins, as you did before, to the Whisper Node so you can see the "Splash" screen. Remember you'll only see the "Splash" screen when you power or reset the Whisper Node.
3. Connect a "wire" to the RST pin on the Whisper Node. This Pin is between the PIN 13 and the GND pin.
4. Open the "Serial Monitor"
5. Connect GND and 3.3V pins from Mega to GND and VIN respectively on Whisper Node. You should see the "Splash screen". If not, just try to invert the TX and RX pins - I frequently get it wrong.

You can try now to "reset" the Whisper Node by touching and holding the RST pin (from item 3 above) to ground. You'll see that when you release it, the Whisper Node will boot and show the Splash screen again.

Now, you can try to upload a sketch, select the Whisper Node hardware on the Arduino IDE and after hit "upload" wait it to compile and when the IDE starts the upload process perform a manual "reset" as describe above, by touching the RST to ground and releasing it.

I don't have an Arduino Mega board but the tests using and Arduino Uno worked fine, so I assume it will work as well for the Mega.

Regarding my suggestion of using the Arduino Mega as ISP, it's not the ideal as I just realized the Mega is a 5V board and it can cause damage to the RFM69 and SPI Flash as both are 3.3V.