Friday, February 3, 2023

Light Buddy 2 - Build Part 1

 

Part of the development time was me copying code from the PIC32 project and not getting all the code.   Then there was a mismatch in the com protocol between the PC and the PIC that had to be fixed. Again, all for the good as I develop a lot more consistent interface and infrastructure code across all of my projects.

When I moved to the PCB two things started happening that were not present on the Microchip Curiosity Development Board.  I could not buy PIC16F18326 parts and had to settle for the LF version.  Should be NO big deal, though it did force the LDO decision to a 3.3VDC version.  First every few seconds the Brown out Reset would fire.  Added code to print out the the registers that tell you what caused the reset, so I know that was it.   Once I disabled BOR, that quit happening.  But now I dont know if what the PIC was seeing is not causing other issues.  

Second the PICKIT 4 is unreliable, not sure why yet.Part of it was a poor connection to the board.  I fixed that, but it will still reset it self after a few seconds.  This is probably related to the BOR issue, just not sure how to debug this, especially if the drop out is very narrow.  Also had to upgrade XC8 and MPLAB X to 5.5, which means the 64bit version.  But as the picture shows I moved to an ICD3 to continue working.

While this PIC runs at 32MHZ max, I am pushing it when running all six LEDs in full feature mode.  I can tell the service loop is not getting around as fast by the way the LEDs react.  It may be OK, I just need more time to refine the loop.  The loop is every 100msec and that may not be enough time to service 6 LEDs.  Also the free compiler does not do a great job on speed optimization.

As an aside, several people have suggested using switches to select the LED modes.  I passed on the switches for now.  The serial port makes it much easier to develop the lighting features and provides a console feature for printf.  Though I had to finish the PC program first before I could get started on the PIC firmware.  Every time I add new features to this Windows software, the whole structure of the program slightly mutates, thus more testing for older features to make sure I did not break them.   The software is getting more structured and easier to modify, just takes time.

No comments:

Post a Comment