I want to use this library DMXSerial2 with my Nano Every but I have troubles configure the USART-Register. Here are the variables of the previous controller:
#define UCSRnA UCSR0A // Control and Status Register A
#define TXCn TXC0
#define UCSRnB UCSR0B // USART Control and Status Register B
#define RXCIEn RXCIE0 // Enable Receive Complete Interrupt
#define TXCIEn TXCIE0 // Enable Transmission Complete Interrupt
#define UDRIEn UDRIE0 // Enable Data Register Empty Interrupt
#define RXENn RXEN0 // Enable Receiving
#define TXENn TXEN0 // Enable Sending
But as I looked at the "USART-Register Summary" from the ATmega4809, I saw, that STATUS and CTRLA (Control A) are two different registers. Does anybody know, in which way I have to configure the register variables, so that the library works on my nano every?
The peripheral registers in the newer AVR chips (including the ATmega4809 used on the Every) are handled significantly differently than in the older AVRs. They're all treated as structs rather than individual registers, AND the USART itself has changed (for example, there are now separate transmit and receive data registers, and the baud rate generator is significantly different.
As @b707 says, you'll need a pretty complete re-write of the code. (well, probably only the USART initialization and ISRs. The DMX parsing looks to be pretty modular.)
Thank you @b707 and @westfw for your replies. You assured me in what I was expecting. I just wanted to be sure that there is no easy option I might have missed I have to consider using another chip so that we can utilize the original library, as we have a very tight schedule for this project. If we still decide to go with the ATmega4809, I would post a link to the solution here.
I already have an alternative, so testing is completely decoupled from the tight schedule I integrated an UNO R3, which was lying around, and it worked just fine.
Now, I have a solid test setup with:
1x ESP32 DMX-Controller,
1x ESP32 DMX-Device with RDM Response,
1x UNO R3 DMX-Device with RDM Response and
1x NANO EVERY which should do the same as the UNO R3.
This allows me to thoroughly test the new DMXSerial2 implementation.
kr, X-Berger.
Yes, that's the topic of this thread
But with both "types" of µController as devices in the same bus, we can test the functionality of the modified library.
Hmm. Is there particular feature of this library (DMXSerial2) that you need? (RDM?)
It looks like DMXSerial - Arduino Reference has already been updated to support the Mega-0 chips used in the Nano Every.