MemberMay 22, 2023 at 3:43 pm
I am trying to debug a rather complex and time sensitive application running on a Controllino MEGA. My problem is that there is quite a lot happening and simply using print statements (besides being inelegant) is just not cutting it anymore.
At first I tried using BetterSerialPlotter and this works quite well for visualizing how the system reacts but sadly cannot give me any insight as to WHY it does what it does.
While I do have everything set up in PIO and can upload code and enter the debug mode my program does not work as intended because it uses millis() -> see this explanation pages 95-96.
Burning a new bootloader is pretty straight forward and there is even an official tutorial for doing so with a Controllino MINI.
On the official GitHub there is an Optiboot version of the bootloader for use with the Controllino MINI. Sadly, however my project requires a Controllino MEGA and for this only the standard bootloader seems to be publicly available.
If I upload a version of Optiboot compiled for the ATMEGA2560 from the MegaCore project, I can successfully run stock Arduino sketches on it (one undesirable side effect is that the bootloader flashes an LED on startup which toggles one of the outputs). The problem begins when I then try to use my original program written for the Controllino since this requires the chosen board to be of the Controllino family (<- insert surprised Pikachu face here…). If, however I choose one of these boards uploading the sketch does not work anymore with a timeout error. As far as I can tell this is because the new Bootloader does not communicate the same way as the standard one does and so the programmer can’t find it. I tried to create a new custom board based on the Optiboot version but with the Settings adjusted so it acts as if it where a Controllino MEGA but I must admit that this goes a bit over my head, especially in PIO.
My question now is threefold:
1. Am I the problem (quite probably yes) and I am just doing something wrong? If so, any hints would be greatly appreciated.
2. Is there any other way of debugging that I am not aware of? This would probably solve this whole issue (and likely create a bunch of news Problems…)
3. Is there a possibility of getting an official version of the Optiboot bootloader for the Controllino MEGA ?
Thank you all in advance. If you need any more Information I will try and give you what you need.
Log in to reply.