You need to log in to create posts and topics.

ATmega128 USART assyncronous connection

Page 1 of 2Next

I made a program for ATmega128 for USART assyncronous connection, specifically.

However, i have no idea how i get or send stuff, i probably need a serial port/monitor. How do i connect it to the ATmega?

Hi.

You can use Serial Terminal (click on "Serial terminal"): https://simulide.com/p/component-list/#peripherals

KerimF and average_simulide_enjoyer have reacted to this post.
KerimFaverage_simulide_enjoyer

i tried to use the serial terminal, by connecting Rx to PD2 and Tx to PD3 (Rx and Tx of USART1), but nothing is happening
I KNOW this code works cuz in a real ATmega128, it worked connected to a real computer

Maybe try Rx to Tx and Tx to Rx.

average_simulide_enjoyer has reacted to this post.
average_simulide_enjoyer

it didnt work still

Maybe share something that I can try?

average_simulide_enjoyer has reacted to this post.
average_simulide_enjoyer

Also I'm assuming that the Serial Terminal is configured for the same baudrate, etc than the USART in the Atmega.

average_simulide_enjoyer has reacted to this post.
average_simulide_enjoyer

It is set to 9600, like the default one.

Ill send the hex file tomorow, and maybe the sim1 file if u wish to see if it's well done

Quote from arcachofo on December 3, 2024, 7:14 pm

Maybe share something that I can try?

this is the USART setup:
UBRR1H = 0;
UBRR1L = 207;
UCSR1A = 0b00000010;
UCSR1B = 0b10011000;
UCSR1C = 0b00001110;
(as u can see, or not, i enable double speed, maybe its that the issue? it uses the next baudrate value, maybe i need to put the next baudrate too in the monitor)

im sending my simulation file and the hex file with the program. try sending s and d. its suposed to switch to s mode, and then u can use the switches to make the DC motor rotate
https://www.mediafire.com/file/3s3lvdzu2c2by0v/atmega128_USART1.zip/file

Thank you.

Found the problem: an error in a configuration file, to fix it replace the file attached here:
data/AVR/mega64_128/mega64_perif.xml

Also connect Rx to Tx and Tx to Rx:

 

Uploaded files:
average_simulide_enjoyer has reacted to this post.
average_simulide_enjoyer
Page 1 of 2Next