Processor Expert is a great tool: it lets me configure all the complexities of that ARM Cortex-M0+ core. But today it has fooled me and I lost several hours of my week-end time :-(. I need a user interface like push button for my project. Yes, the FRDM-KL25Z has touch area, but honestly: that kind of stuff never worked out well for me. It is probably just me having it not properly set up. The touch slider is working as in my earlier simple example, but in my other project with more hardware around it, it is working sometimes, sometimes not. Ahrg! I can blame my ignorance, my lack of understand how to configure it properly, or the extra noise by the hardware around it. Result is: I wasted a lot of time, and I give up :-(.
❗ Lesson number 1: if something is working in a small project, it does not mean that it works as well in another context.
Instead loosing more time using the TSS library, I decided to use the Reset button on the Freedom board instead. A nice feature of the KL25Z is to disable the Reset function and to use it as a general purpose I/O pin. I did this already in an earlier project, and it worked. So it should not be a big deal to have it as well in my other project?
❗ Lesson number 2: never make the assumption that if something worked in one project, it works in another.
So I added a BitIO and configured it for PTA20/RESET_b:
Next, the CPU component rightfully complains about using the Reset Pin twice:
With disabled Reset Control, Processor Expert is happy:
Generating Code, building the application, then downloading it to the board, and then I tried it out: pressing the Reset/SW1 button, and……
Outsch. But I have configured it to *not* reset. What’s wrong?
Ok, probably my fault. Checked the settings again, generated code again, downloaded it again, and ….. RESET!
Ok, going back to my earlier project, and: here it works! Ok, so I have missed a setting?
❗ Lesson number 3: Having written a tutorial on a topic does not mean that I will be successful in that topic the next time. I need to burn my fingers once or twice first.
As comparing Processor Expert settings is not really simple, I decided to compare the generated source code.
💡 Comparing the ProcessorExpert.pe XML file is not really practical. What works in most cases is to ‘pin’ one component inspector and compare it with the other. But this is only practical for simple components. And I do not think I would have found my issue that way.
And indeed, after I while I have found that my project does not set RESET_PIN_CFG to zero in Cpu.c:
And now this was ringing a bell! And yes, indeed, I missed this other setting here where I need to disable the Reset Pin Function:
❗ Lesson number 4: Read carefully what you have written in the past. Don’t think that you just can browse through it. I had that screenshot in my earlier post, but simply missed it :-(.
Ok, now I probably will remember next time :-).
❓ That setting is buried under Flash Configuration field > Peripheral Settings. Yes, that kind of stuff is in that part of the microcontroller. But very, very easily to miss. Or should I think about ‘Reset functionality’ when I read ‘Flash configuration’? It would be really great if Processor Expert could add a ‘search’ for all fields of a component, especially the CPU component, as it has so many settings.
Ok, I learned my lessons. And maybe there is another one:
❗ Lesson number 5: Even if Processor Expert simplifies a lot of things, the cause of this are these incredible complex microcontroller today. Looks like I still need to read the several thousands of Reference Manual pages, and to read it probably several times? 😦
Now that Reset button is working as a normal user button, so I can continue my week-end project. And I hope I can prevent someone else to fall into the same trap I did.
Happy Reseting 🙂