gnea / grbl

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino
https://github.com/gnea/grbl/wiki
Other
4.04k stars 1.61k forks source link

Atmega328PB #1203

Closed mionut22 closed 1 year ago

mionut22 commented 1 year ago

Hi,

has anyone succeded to use Grbl on an AtMega328PB board?

I can compile the code with some warnings (src/serial.c:109:1: warning: 'USART_UDRE_vect' appears to be a misspelled 'signal' handler, missing '__vector' prefix [-Wmisspelled-isr] for instance), the MCU can be programmed, but Serial communication is not working.

The same Board is working in an Arduino framework, Serial is performing as expected (IO, interrupts, etc.).

Can anyone point me in the right direction to solve this? The board is an GroundStudio Jade Nano+ (https://github.com/GroundStudio/GroundStudio_Jade_NanoPlus).

Thank you. ;)

mionut22 commented 1 year ago

The Atmega328PB has 2 UARTS. The solution was to change the defines of the RX/UDRE interrupt vectors from USART_RX_vect/USART_UDRE_vect to USART0_RX_vect/USART0_UDRE_vect in cpu_map.h.

I hope this will help somebody, one day. :)