This week, I explained to Dr. Shawn about the fact that the USB code managed to work on the PIC32MX but not the real boards in which he suggested to reduce the clock speed of the real boards to match the ones on the PIC32MX as it could be some form of rate-limiting for keyboards since the clock speed on the real boards were higher. Tried it but unfortunately it did not work. However, the rate-limiting idea gave a bit of insight into what might cause the issue. With the lack of better ideas, I added delays into almost every line of the code and to my surprise – it worked! Much was still to be done however as Dr. Shawn mentioned that adding delays only masks the problem instead of solving them so I planned to remove delays where unnecessary and cut down on the rest of the code since now we have a working piece of code.
At the end of the week, while I managed to achieve most of the required objectives like cutting down on the usage of semaphores and removing delays, I did encounter a myriad of weird issues that did not make sense at all which I am still trying to investigate what may have went wrong during the clean-up stage. With the addition of Base64 support along with other improvements, I almost called it a day until I accidentally discovered that by removing the delay that was initially thought to allow the keyboard to work, the keyboard still managed to print out strings consistently. Something is very odd here and I hope to get to the root of this issue soon.