Microcontroller ATmega644P (RX and TX)

Hi everyone,

I would like to ask you guys if you could help me out with the following issue.

I am a little stuck but at the same time confused. I am trying to work with the RX and TX pins of the ATmega644P, but I am getting some rare responses.

This is the issue. I have an electronic board with the ATmega644P microncontroller managing all the electronic components. The board has, among others things, a connector for a bluetooth module (I am using the HC-06) and which I pretend to establish communication between the microcontroller and the bluetooth module using the RX and TX pins.

The thing is that I have been able to transmit from the Arduino IDE to the software terminal (CoolTerm). However, for some incomprehensible reason, I can get the data on the Arduino IDE when trying to send something back from the Coolterm to the Arduino IDE.

I am using the Sanguino firmware for the ATmega644P. I have switched the RX and TX pins between the microcontroller and the connector but nothing happens. Only I am able to send data from Arduino IDE to the CoolTerm.

I tried both the Bluetooth module and the code in a Arduino UNO and it perfectly worked at the first try.

After spending many weeks I do not know what the problem could be. I am thinking about the compatibility of firmwares of the microcontroller and the bluetooth module as explanation because after trying many things I have not able to establish the communication.

Do you have any thoughts?.

Thank you.

Do you have any thoughts?

Yep, mega664p has two hardware UART.

which port are you using?

Use MightyCore

which I think has Serial and Serial1 for those ports.

Hi ron_sutherland,

First of all, thank you so much for your answer and my apologies for getting back to you late.

Regarding the UART, I already knew that the ATmega644P had two UART. I am using the “Serial”. The microcontroller what I am using is slightly different than the one in the picture. It has 44 pins. I am using the pins 40 and 41 because the board has those pins already set up (traces) to do the function of trasnmitting (TX) and receiving (RX).

Since I got your reply yesterday, I have been searching information about MightyCore but I am noy sure what it is exactly.

The other thing is regarding the libraries. I am using the SoftwareSerial.h library and I am not sure if I need also to use/include another library such as HardwareSerial.h which is refered in the second link you posted.

Ron_sutherland, sorry if I am overwhelming you with this issue but it is pretty important to me to figure out what is going on because I need to move forward and any help is always very welcomed. These are a couple of questions I would like to ask you:

  1. Is MightyCore a firmware? If so, is it compatible with Sanguino? If not, can both be compatible?.

  2. Do I have to include the HardwareSerial.h library in the skecth or wherever with the SoftwareSerial.h library in order to the RX and TX work properly?.

And again, thank you so much for your reply. I really appreciate it.


Arduino's "Core" as it is sometimes called is the libraries the IDE compiles programs with, some of them have to do with the on-chip hardware (e.g. the ADC, Timers, UART...), and there are some others.

The first thing I want to make clear is that this is a Core for learning it has some problems and if you get to the point you can understand the problems that would be wonderful.

The MightyCore is one of Hans projects, which I look at from time to time for my own projects. It is reasonably faithful to the original Arduino Core, but it is done for other microcontrollers. The MigthyCore is done for parts with similar hardware (e.g. the ATmega664p), and may also give you some clues about your upgrade (ATmega1284p) and downgrade options.

I suspect that software serial will work on MightyCore, but I have a bad reaction to the idea of software serial, it is not something I would want to explore. It is in the Core libraries, the pins you listed are at PCINT8 and PCINT9 (which I think is needed), in theory, that should be doable.


I don't see any libraries in the Sanguino Core (if I am looking in the correct repository).


Do I have to include the HardwareSerial.h library in the sketch or wherever with the SoftwareSerial.h library in order to the RX and TX work properly?

The core has a file (or more) that tells the IDE where to find the libraries and how to operate the compiler. Some like to use a Makefile to do that sort of thing but either way, it all has to be there.

Once you install the core

then options for ATmega644p should be available. SoftwareSerial can be included in your program and the IDE should use the correct library from MightyCore.

is it compatible with Sanguino?

Probably, but I'm not giving a warranty, hopefully, you have a schematic for your board and can look at it through the eyes of MightyCore.

UPDATE: looks like


Hello ron_sutherland,

Again, thank you so much for your help and sorry for getting back to you late.

Today I have been carefully reading and analyzing all you wrote. Without doubt, it has been an excellent explanation. The links are great. I have also done some research to better understand how the Core works and i think it makes sense or at least can be a serious alternative to get the final purpose.

During today, I have also been preparing the steps to follow, that is, how to install the MighyCore.

I think I am already ready to test the MightyCore on the ATmega644P. I feel confident. I hope not to be wrong, but I think I can see some light at the end of the tunnel.

In a few hours I am going to the lab to test it. Without doubt, I will let you know how it was.

By the way, thank you for the update of picture of the microcontroller.

Thank you so much for everything.


everything makes a bit more sense. I do not know if it can be the solution but what I am sure

Hello ron_sutherland,

Sorry for getting you back late, but during these days I have been testing many options about MightyCore. However, I have not been able to get it work. This is the issue:

  • After installing MightyCore or "Core" using the URL shown in the links of MightyCore, Arduino IDE enables the options for ATmega644.

  • I choose the "P/PA" option, which I think it is the right option for the microcontroller I am using.

  • Regarding the pinout, I choose the "Sanguino Pinout".

  • The only doubt I have it is as for the "Programmer". I have tested/tried many options, especially with those which have a name related to Mighycore. I did not get anything.

I think everything seems okay in the Arduino IDE. According to the "Board Managers" option the "Mightycore" is "installed". From my point of view, if the Arduino IDE enables all the options means that everything was installed right. However, when I run the code, nothing happens.

With the "Sanguino" board I was able to send data from the Serial port to the Software Terminal (Cool Term) and nothing back from the CoolTerm to Serial Monitor of Arduino IDE. But now, running the same code having chosen "ATmega644" board nothing happens. I have switched the RX and TX pins but I did not get anything.

Ron_sutherland, do you have any idea of what could be happing? Can you give your opinion about the code am using? I can post it to see if there is something wrong, but this code with Arduino UNO works very well and at the first try.

Thank you so much again for you help.


Can someone help me out? Does somebody have any idea?

Thank you very much.