Interfacing SAMG55 USART/UART with other microcontroller

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I am new to Atmel studio and SAMG55 microcontroller.

I am using DK20648 TDK InvenSense. In that, SAMG55 is interfaced to ICM20648 using I2C/SPI. I am using I2C. Now I want to transfer this data from SAMG55 to other microcontroller using UART.

So I connect SAMG55 USART0 pins (Rx: PA9, Tx: PA10, CTS: PA25, RTS: PA26) to UART pins of other microcontroller. USART0 on SAMG55 is used for FTDI.

Now the problem is: on other microcontroller I always receive garbage values. I have set baudrate as 921600 on SAMG55 and other microntroller also. On SAMG55, baudrate was 2MHz for USART0. I changed it to 921600.

I am not understanding why the garbage value is received. What am I doing wrong?

Is it okay to use FTDI UART pins to transmit the data or should I use some other UART port?

 

Last Edited: Mon. Mar 9, 2020 - 11:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jck wrote:
SAMG55

That's not an AVR !

 

SAM forums are here: https://community.atmel.com/atme...

 

EDIT: Has now been moved to appropriate forum.

 

jck wrote:
I am new to Atmel studio and SAMG55 microcontroller.

Are you familiar with any other microcontroller(s) and/or any other IDE(s) ?

 

 

jck wrote:
I always receive garbage values

Not specific to any particular type of microcontroller - see Tip #2 in my signature (may not be visible on mobile)

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Mar 9, 2020 - 11:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I read the Tip #2 which you suggested. From that it is clear that baudrate of both devices should be same and UART port can be connected to the one device at a time.

So my configuration is this:

I have set baudrate of SAMG UART to 921600 which will transmit the data. Then I set UART2 baudrate of nRF9160 to 921600 which will receive the data and I set UART0 of nRF9160 also to 921600 which prints the data to terminal. But still on nRF9160, garbage value is received. I have checked the received data of nRF9160 on oscilloscope. It is correct. But still only the junk characters are received at nRF91 side. SAMG sends data after every 5ms.

What can be the problem? What else I should check?

Actually SAMG uses UART0 to send data to FTDI. But there are jumpers to connect to FTDI. If I remove these jumpers, I can use the UART pins on SAMG for use case. So I remove those jumpers and connect to nRF9160 UART pins. Same UART port can not be used to connect to two devices. So the jumpers are removed.

Is it okay to use this UART port of SAMG?

If there is anything else I should look on, please tell me.

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also Parity, number of bits, etc need to match

 

jck wrote:
I have set baudrate of SAMG UART to 921600

And how have you confirmed that you are actually getting that baud rate?

 

What clock source are you using?

 

Does it have to be that fast - do slower rates work OK ?

 

I set UART0 of nRF9160 also to 921600

same questions.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I'm having "same" issues with SAME54 Xpro.

I used the Atmel START to set e new UART project.

It works perfectly.... ( it just send "Hello World!  @9600)

Then I tried to change the baud rate using usart_async_set_baud_rate.
The baud rate is changed, but not at the expected value.

To get 57600 I have to use 64240.
(I found this after many tests and using the oscilloscope).

This doesn't make sense to me.

For some reason (I don't really know) it seems that the baud rate you set is not the one the system will use.

( maybe I have to sart a new post for this issues...)