chandlerbing65nm
Member level 5
I am relatively new in Atmega MCU's (too used with graphical interfaces). I am using an external clock with 8MHz in my Atmega2560. My problem is that I cannot use UART communication with PIC18->Atmega2560 and STM32F4->Atmega2560 (no acknowledgements).
I thought that it is my baud rate that is not right, maybe the Atmgea2560 is using prescaler div by 8 in default (not familiar with Atmega). So, I forcely changed the prescaler to div by 1 using this little code:
I also use this one in the bootloading/programming:
Now, when setting the Atmega2560 Serial, Serial1, Serial2, and Serial3 to 9600 baud rate and PIC18/STM32F4 to 9600 baud rate, can my problem in UART be vanished (ack's will receive)? -theoretically
I cannot verify it now since it is weekend, things are in the office.
To those who are expert in this things, your help is much appreciated.
Regards, Tim
I thought that it is my baud rate that is not right, maybe the Atmgea2560 is using prescaler div by 8 in default (not familiar with Atmega). So, I forcely changed the prescaler to div by 1 using this little code:
Code:
void setup() {
noInterrupts();
CLKPR = 0x80; /*Enabling the clock prescaler function*/
CLKPR = 0x00; /*Setting the prescaler to div by 1*/
interrupts();
}
I also use this one in the bootloading/programming:
Code:
2560.menu.clock.8MHz_external=External 8 MHz
2560.menu.clock.8MHz_external.upload.speed=57600
2560.menu.clock.8MHz_external.bootloader.low_fuses=0xf7
2560.menu.clock.8MHz_external.build.clkpr=
2560.menu.clock.8MHz_external.build.clock_speed={build.f_cpu}
2560.menu.clock.8MHz_external.build.f_cpu=8000000L
Now, when setting the Atmega2560 Serial, Serial1, Serial2, and Serial3 to 9600 baud rate and PIC18/STM32F4 to 9600 baud rate, can my problem in UART be vanished (ack's will receive)? -theoretically
I cannot verify it now since it is weekend, things are in the office.
To those who are expert in this things, your help is much appreciated.
Regards, Tim