Go Down

Topic: Using TX3 and RX3 ports (Read 1 time) previous topic - next topic

pert

Can you post the code running on the ATmega controller?

pert

how can I change the clock frequency in DUE. Its default is 4 mhz. I want it at 16mhz
I don't know much about the Due, but I'm pretty sure it runs at 84 MHz, not 4 MHz (reference: https://store.arduino.cc/arduino-due). Why do you want to change it to 16 MHz?

chutki

I am sory the code for atmega is a combination of very large files and I cannot post it. I want to change to 16mhz because atmega works at 16mhz and DUE is not 16.To establish a UART communication between them, I want both of them to work at same frequency.

What I am actually tryin to do is : atmega board cannot be directly conncted to PC , so I am using the DUE to connect it via USB. So connecting them via UART.

pert

expectation.png:

NOOOOOO! We've already been through this.

There are two ways to go about this:

1. Due as USB-serial adapter:
  • Hold the main microcontroller on the Due in reset.
  • Connect the sensor to the Due RX-RX0, TX-TX0


2. Due as a serial pass through:
  • Upload the code I posted previously to the Due.
  • Connect the sensor to the Due RX-TX3, TX-RX3


Either way, the diagram you posted above will never work.

chutki

Thank you soooo much. After holding it in reset, I had connected rx-tx (I never realised it)and that is why it never worked. Really thankful to you.

pert

I told you that 2 days ago:
OK, so you're actually just using the Due as a USB to serial adapter. For that purpose you should connect sensor RX to Due's Rx0 and sensor Tx to Due's Tx0. I know that seems wrong at a first glance but the pin labels are relative to the SAM microcontroller pins but you're not using the microcontroller, you're using the ATmega16U2 USB-serial chip, which is connected to 0 and 1 opposite to the labels on the pins (because it's connected to the SAM microcontroller RX-TX, TX-RX). So when you make the RX-RX, TX-TX connections between the due and the sensor you're actually doing Rx-Tx, Tx-Rx with the ATmega16U2.
Well I'm just glad to hear it's working now.

pert

Question about changing the Due clock speed also posted here:
https://arduino.stackexchange.com/q/46374

If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.

chutki

Okay , hereafter I wil post the links. The option 2 did not work for me. Instead of the device , when I connected another DUE it did work.

Go Up