I have been messing around with Microchips DALI2 slave stack (for industrial lighting control) and I have managed to get it to compile and run on at attiny1616 using MegaTinyCore.
I encountered a couple of odd issues and I wondered if anyone had any insights.
The stack is all written in c, but I changed the c files to cpp, and added a #include <Arduino.h> to the top header in the stack, and that was enough for it to compile in Arduino.
The code kept crashing and I traced it to a case statement that dealt with fading the lights. I couldn't see any reason why it should crash at this point but I got it working by changing the switch to a series of if/else statements. The stack now works fine and I can using it to control an LED light from a Lunatone DALI2 room controller.
I then changed from an attiny1616 to an attiny3217 - the only differences being double the flash memory and four more pins - everything else is the same in terms of peripherals, memory map etc.
When running on the 3217 the device is constantly trying to run a fade sequence, or will crash, depending on whether I enable millis on TCB1 (All the other timers are used by DALI).
I'm at a loss as to why it works on one device, but fails on one that just has more memory. Everything else is the same, including clock sources, speeds, WDT, BOD etc.
Any ideas on where to start identifying what the problem is?
Note: I can post code, but I thought I would start with a general question because of how odd the issue is and the code covers 16 files. The DALI stack example project for MicrochipStudio is here:
https://start.atmel.com/#examples/DALI2
EDIT: I just had a thought and exported a compiled binary of the code for the attiny1616, then used a programmer to flash it to the attiny3227. It has stopped misbehaving (but default values are a bit messed up) so I am starting to think its a compilation issue?