This is my second week in Aeste, I was tasked to familiarize my self with MPLAB X and also harmony configurator, especially on USB stack and tcpip stack.

For the tcpip part, I needed to host a web page on the pic32 esk, and after that was to enable ssl. There is already a wolfssl tcpip demo in the harmony configurator which you can use. But you have to copy the project to another location and set the directory of the harmony configurator. Just compile it and run, and it’ll create a ssl enabled local web server on the pic32. You can view it by opening a web browser and type https://<PIC32_IP_ADDRESS>. A simple way to find the ip address of the pic 32 is to use the tcpip discoverer, located in/opt/microchip/harmony/v1_08/utilities.

View the certificate and you will see that it is the default wolfssl certificate. Now to create a self sign certificate, you can find some useful instructions online, to obtain a cert.der and a key.der file. To convert them to hex, use

$ hexdump ’12/1 “0x%.02x, “”/n”‘ yourderfile.der

This creates a nice format that matches with the one in the wolfssl server demo, basically it displays 12 hex numbers in a row, and each hex starts with 0x, and separated by a space.  Format quite similar to printf function in c.

After that you need to change “server_key_der_2048[]” and “server_cert_der_2048[]” part in certs_test.h in header/framework/crypto/src. You might find that you cannot change the contents cause its read-only, so just make a new header file with the same name in src, copy all the contents of the old file and paste into the new one, include the new file and exclude the old file. Find server_key_der_2048[] and server_cert_der_2048[], and replace the contents inside with appropriate hex obtained using hexdump. Also you need to change some #include in net_pres_cert_store.c, located in Source/app/system_config/pic32mx_eth_sk/framework/net/pres. Change the #include “wolfssl/certs_test.h” to just #include “certs_test.h” and it should work.

for the usb part I need to configure the pic32mx ethernet starter kit to act as a keyboard. Just use the example provided for hid_keyboard, run it and you’ll find that the computer will detect a keyboard. Open mousepad(or any place that you can type into) and press SW1, and the sequence abcdefghijklmnopqrstuvwxyz1234567890 will be typed out. I managed to manipulate the code in a very crude way to output a desired string, but my goal now is to change it so that it can be able to input any string that I want, but the problem is that each key is initialized using a corresponding hex value, only 1 key can be initialized at a time and also it doesn’t have hex for capital letters and symbols such as @,%,&,* and so on. I’m still trying to figure out how to initialize 2 keys at a time(shift and the letter) or maybe it does have a hex that wasn’t included in somehow. I’ll have to manipulate the code to read a string to input by the pic.

Categories: Experiential

Leave a Reply

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