ATSAM4E - EK

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

Hey all!

 

i am currently working on a SAM4E - EK evaluation kit. i had a few issues and questions regarding the serial communication.

Before i start i must say i am a newbie and have been going through basic programs since the last week or so played around with the switches and blinking leds but I haven't been able to get the serial communication to work. I have connected the board with an ATMEL ICE, for serial communication I have used an USB FTDI cable which is interfaced with the board with a rs232 converter. Here i have connected the tx,rx and the ground of the ftdi cable to the rs232 converter. 

i am using putty as a serial monitor but i have also seen the same garbage valued outputted in the inbuilt data visualizer as well.

baudrate: 115200 as stated in the description of the example program.

 

so when the programming is running, and i go to see the output it is just a bunch of garbage variables and they only seem to appear on the start up and each time when i click the reset switch SW1.

 

1. So my question is that would this be a simple case of the wrong baudrate, not connecting the wires properly to the converter or would there some other underlying issue that im not aware of.

 

2.My second question is that is there another way to connect the sam4E-ek board with the PC ? maybe im stupid but so far what ive read is that ATMEL ICE can flash the microcontroller but to read serial is only through the UART port, and in this case the rs232 connector.

This topic has a solution.
Last Edited: Sat. May 29, 2021 - 09:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


aixit7 wrote:
SAM4E - EK

This: https://www.microchip.com/Develo... ?

 

Any particular reason for choosing that board? It seems rather old and over-complicated for a beginner?

 

aixit7 wrote:
would this be a simple case of the wrong baudrate

Most probably - See Tip #2 and Tip #3 in my signature.

 

aixit7 wrote:
is there another way to connect the sam4E-ek board with the PC ?

It has ethernet - but that's going to be way more complicated!

 

Have you tried the 'Demo Binaries' ?

 

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


Thank you for the detailed response.

1. Any particular reason for choosing that board? It seems rather old and over-complicated for a beginner?

im working on my thesis in a company and developing the firmware for the SAM4E microcontroller, and the SAM4E-EK was the developmental board that they gave me to do my testing etc. i didnt really have a choice in choosing the board/microcontroller. Ive worked with microcontrollers in the past but with arduino UNO, arduino M0 pro and familiar with the arduino IDE, but comparing it to ATMEL studio i feel its like comparing a mud hut to a house made of bricks, almost the same but totally different level. I may be worng in that sense. At times i feel like have no clue what im doing.

 

2.  Most probably - See Tip #2 and Tip #3 in my signature.

I checked through the baudrate etc it seemed to be what i had declared i.e., 115200 , but i found out that the output of the RX and TX was set from the pins PA09 and PA10 of the board, and i was able to get the serial output they were connected. i checked through the data sheet and just thought of giving it a shot. previously i had hooked it up to the rs232 connector on the board and was just getting garbage values.

 

 

 

3. i have now run into another problem, the board only seems to print data to the terminal(puTTY and the data visualiser) and wont read any data that is being typed. like if i type anything in the terminal it is non responsive, maybe its not reading it? but again its an example pogram that has been loaded onto the board. 

 

 

 

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

aixit7 wrote:
im working on my thesis in a company and developing the firmware for the SAM4E microcontroller, and the SAM4E-EK was the developmental board that they gave me

So, surely, they should be able to help you to get it set up?

 

wont read any data that is being typed

Have you verified that the data is actually reaching the microcontroller pin?

 

 

maybe its not reading it? but again its an example pogram that has been loaded onto the board. 

So what does the documentation of that example program tell you?

 

Do you have the source code?

 

Have you used the debugger to see what's going on?

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

 

So, surely, they should be able to help you to get it set up?

So far ive been going through alot of documentation and videos, data sheets solved examples to get a grasp of atmel.

 

 

Have you verified that the data is actually reaching the microcontroller pin?

Do you mean like a loop back ? Im not really sure how to do that. how would you recommend to do that? 

 

 

So what does the documentation of that example program tell you?

The documentation doesnt really say about the connection, just the initializations of the uart, baud rate and clock frequency etc. and the main.c file which has the main logic of the program to read and write data to serial.

 

Do you have the source code?

Yes i do, ill upload a zipped file of the example program.

 

Have you used the debugger to see what's going on?

Yes i did use the debugger, and also the step in, step over functions. The flow of the programs seems to fall in an infinite loop at the if loop where its supposed to check the input variable from the serial. im sure why its doing that. 

the if(!uc_flag) is the loop that i am talking about. it just goes in an infinite loop i.e., goes back to the while loop, and checks the if loop again and goes to the while loop again. not exactly sure why its acting like that. Like you mentioned, the input through serial is most probably not reaching the pin. but i am not sure how i can test if it is or not.

 

 

Attachment(s): 

Last Edited: Tue. Jan 25, 2022 - 09:30 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


I did a quick google search about the loop back check, and connected the RX and TX of the USB FTDI cable, and checked on the puTTY for the signal, and its working. the serial is working. so i dont think there is anything wrong with the serial communication, just with how the board is handling the incoming data.

 

double letters due to local echo turned on.

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

aixit7 wrote:
the person i am working under is not really experienced with atmel either as he is an electrical engineer

Seems a bit unreasonable to expect you to do this without adequate support.

 

I wrote:
Have you verified that the data is actually reaching the microcontroller pin?

aixit7 wrote:
Do you mean like a loop back ?

I was thinking more of putting a scope on the pin to check that the signal is actually there

 

The trouble with a loop-back is that, if it doesn't work, you still have no idea where the fault is - so you're going to have to get the scope out anyhow.

 

Im not really sure how to do that. how would you recommend to do that? 

The board has a 9-pin D-type - you could simply short the Rx & Tx

 

So what does the documentation of that example program tell you?

The documentation doesnt really say about the connection, just the initializations of the uart, baud rate and clock frequency etc. and the main.c file which has the main logic of the program to read and write data to serial.

 

Yes i did use the debugger, and also the step in, step over functions.

So have you confirmed that it is actually seeing any received data? Or getting errors like framing, etc?

 

Please see Tip #1 in my signature, below, for how to properly post source code.

 

It looks like the code is interrupt-driven - so put a breakpoint in the receive interrupt service routine (ISR)

 

 

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...
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was checking the connection again, and it was wierd because when i connected the USB ftdi cable to a rs232 adapter (connected the tx, rx and the ground) to the boards DBGU, the serial communication would work, but output all garbage values to the terminal i.e., scanning and printing both would work but give garbage vals. When i connect the cables directly to the pins pa9 and pa10 with the ground, i would get only the output on the screen as shown in the pics above but it would not receive the "user input".

i discussed it with my supervissor and he suggested i change the cable connecting the pc to the board, and actually use a usb-rs232 cable. 

This seems to rectify the problem that was occuring. Not a baud rate issue but a cable. Now i am able to read and write from the terminal.

 

Anywas, thank you for awneil for the suggestions, espcially with the use of a scope and the db9 pin connection, because i was thinking about doing those steps if changing the cable had not of worked.