PIC32 Serial Console and Configuring a FPGA
This is my tenth week in AESTE. Continue fixing some minor bug for my wolfssl TCP server state machine and adding some additional features.
Correcting some misconception
For my previous post, I mention about the IP address being different from the one preset in Harmony Configurator, and the solution was to remove some TCPIP stack features to solve the issue. This solution is slightly misleading, because the problem was because ‘DHCP Client’ was enabled, with this feature enabled the IP address will be auto assign/change during run time, so the question would be how do I know the new IP address that was generated/assign? From the Harmony example code, one would found these line of codes ‘SYS_PRINT or SYS_MESSAGE’, these functions was really useless to me at first, because during run time nothing will be output from those code, and no ‘com’ port available to connect to, but after reading and digging into it deeper, I realized these function can do some interesting stuff!!!
Both ‘SYS_PRINT and SYS_MESSAGE’ are actually ‘printf’ for a C compiler and maybe one can think of it as ‘UART’ that will output the message into a terminal. To make it work properly and to be able to use these command properly:
1. The ‘mini-b’ Debugger port must be connected to PC
2. Connect the ‘micro-usb/micro-AB’ port (Device, Embedded Host, On-The-Go) with a cable and connect to PC
In other words, there will be 2 different cable connected to 2 different USB port of PC, assuming you are using Windows, one can find the PIC32 ‘com’ port in device manager, for LINUX, assuming you using ‘minicom’ as a serial console terminal, type: ‘minicom -o -D /dev/ttyACM0’, if ‘ttyACM0’ is not the correct port then change it to ‘ttyUSB0’ then Walah!!! something magical just happen~ (∩｀-´)⊃━☆ﾟ.･｡ﾟ☆✿:・ﾟ✧
With this ‘SYS_PRINT and SYS_MESSAGE’ works! The altered IP address when ‘DHCP Client’ was enabled can be solved, by just looking at the output IP address in terminal, EZ~ ಠ_ಠ #what #unimpressed
So….. yeah~ that’s how it is. (^^;) (^^;) (^_^;) !!!
Next I continue changing my codes flow, to ensure the StateMachine is correct. I also read up ‘spartan 6 fpga configuration‘ to understand how to program a FPGA using PIC32. Luckily I dig some old post from AESTE and found this. After reading previous interns’ post and double confirm from Xillinx document, I choose to use Slave Serial method to configure my FPGA. The code set up was really easy, just few lines of code then I could use Master SPI for PIC32 to communicate with FPGA, however, this is just a theoretical method (I could not prove whether it will definitely work), and for the time being I will put this method on hold first, because there might be a possibility I will be changing another chip for my project, PIC32MZ to be exact, and for MZ series, to configure FPGA I might consider using ‘External Bus Interface (EBI)’ to program my FPGA.
This week I also able to compute SHA1 calculation by feeding in FPGA bitstream data into my SHA1 generator. My SHA1 is computed using wolfssl library and I also realized that the current Harmony library does not come with Microchip Technology ‘hashes.c’ and ‘hashes.h’, therefore wolfsslcrypt folder will be the only available source code to generate hashes for my project.