Started the week by continuing on with implementing a hid keyboard on the pic32. While doing this I encountered two major problems, one is that the keyboard refuses to output two of the same characters consecutively, the other  problem was when I tried going through the character array starting from the 0th position, it starts from an arbitrary position instead (sometimes 5th, 6th, but mostly 11th to 13th position). For the problem that it doesn’t print out two same letters consecutively, my solution was to initialize a no-event in between the actual outputting of characters. I declared an integer i2, which value increases by one each time it goes through the loop, but I only print the characters when its an even number, the rest is a no-event loop. My solution to the other problem has no actual logic, instead of starting from the 0th position, I started from a negative number instead. Usually this would give an error as there is no such thing as the negative nth position in a character array. Surprisingly this method outputs the string correctly almost every time (I’ve tried declaring i2 at -20, even -100 and it still works). The problem would most probably be due to initial declaration? Because I’ve included a code which resets i2 to 0 when a button is pressed and it works perfectly.

After that I started with the actual board. At first the code for TLS_tcp_Server wasn’t working, some of the function declarations had too many arguments and some had too few instead, so just check for the appropriate argument type and remove any extra arguments in the function. There was also another problem in which the compiler insists that the variable Des3 wasn’t declared, but tracing back I found that it was indeed declared, and the header was indeed included, which is also weird. So instead of using the header, I just copied its the definition (which wasn’t too long) into the source file and it worked. Then just follow the git wiki page how to start. Afterwards was the pic32blinktest, phytest etc. The codes compiled without problem (Had to remove the BSP first in mhc) but then the boards did not respond as expected. I tested the code flow and found that the code stopped with an error saying that some error occured, (tcpipStat < 0). I went through some forums which also mention this problem  but I’m still trying to work this out, but otherwise the codes seem to be working fine.


Categories: Experiential

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.