Arduino power cycle needed after library modifications

Hi All, I'm working with an Arduino Uno board, Arduino IDE 1.8.0 and a free library from "Electronic Assembly" to drive DOGM series LCD displays.

I made some modifications on the cpp library file and I noticed that in order to make my changes to take place I had to perform a hardware power cycle of the Arduino board.

I made my changes directly in the library folder of the Arduino IDE, and saved them with Notepad++. What happened is that my library mod had some bugs which made the sketch not working properly, but I could not notice that until I performed a power cycle.

The sketch seemed to always work because I worked with the original library first, and then modified the library code without powering cycle the board. I was able to see my bugs only after power cycle. It's pretty weird to explain but that's what I noticed, and the only reason IMO is that without power cycle the library changes don't take place.

Has someone noticed the same behaviour even with other libraries?

Thanks for the attention. Kind regards. Antonio

I don't understand. When are you uploading this code to the board? Just changing the libraries on your computer does nothing to the board until you upload the new code. Uploading the new code resets the board, essentially power cycling it. You can't make a change without uploading code so you can't make a change without resetting the board.

Can you talk about the process? When do you upload? Then what happens? When do you power cycle? Then what happens? Avoid words like "works" or "doesn't work". Give us real details about what happens or doesn't happen.

And post the code you're talking about. How people think anyone can help them with a programming question without seeing some code is beyond me.

I try to better explain. The sequence of what I experienced is this one:

  • loaded example sketch "dogm162_3V.ino" compiled with original library "dogm_7036" -> the sketch worked;

  • made some changes in the library (unfortunately with some mistakes at runtime) and reloaded the example sketch -> the sketch worked

  • remove the USB -> Arduino OFF

  • reconnect USB (no other SW loading) -> previous sketch starts but does not work! (my bugs become visible)

  • go back to the original library and reload the sketch -> the sketch works

  • unplug and plug the USB -> the sketch still works

How would you explain something like that? IMO there is no other explanation rather than the one I mentioned before. You can find the code online on the "Electronic Assembly" website. If you really need to have my library mod with the bug I can send it but anyway my question was a bit more general, in case someone of you experienced something like that with other code.

Many thanks. Bye. Antonio

Without knowing what the code was it is pretty impossible to help you. Without specifics of what you observed it is impossible to help you. "It worked" or "It didn't work" don't tell me much.

This is the code I’m dealing with. In the original library zip file (DOGM_7036.zip) you can also find the example sketches.

When I said the sketch didn’t work I meant I always got a blank display (no chars visualized at all). I believe this is only because of my changes managing the SPI bus visible in my library version with bug. Basically I think I didn’t follow the correct sequence enabling the CS signal and starting the SPI.beginTransaction() function. Moreover I forgot to use the SPI.endTransaction() function at the end.

When I updated this code with the one in the file “new modified dogm library without bug.zip” I’ve got the correct display visualization even USB after power cycle. This is I guess because I used the correct timings enabling CS and I also used the SPI.endTransaction() function at the end.

Hope this gives you more details. If you need more let me know.
Thanks for your support!
Kind regards.
Antonio

DOGM_7036.zip (14.1 KB)

modified dogm library with bug.zip (3.71 KB)

new modified dogm library without bug.zip (3.68 KB)