The test proceed into testing whether the slave modules are able to perform at high speed, without manual inputs. First, I initialize the Python code on the RPi to 25 MHz and I try to verify the functionality of the module. But, before that I found the ADC modules has been displaying extra bytes of “0b00 0b00” at the terminal. I initially thought it was a part of the program and until I asked Kin Wai about it, and it seems those extra “0b00 0b00” are not intended. While asking about the ADC modules, I also asked him about the other slave modules and how I could be able to verify the functionality of it. For the flash module, data can be written into a specific address and can be read back from the flash using MPLAB. The data that is written into the flash can be verified through MPLAB after uploading the program from the PIC and view the memory address that is intended to be written in the Program Memory window. For the ethernet module, it is much more difficult to test and he suggest me to try to read and write from the control registers to test its functionality.

I started out trying to fix the ADC but it seems I couldn’t figure out the exact problem then I proceed in working with the flash. It turns out that flash is also not writing anything into the windows and I had to verify that the instruction sent by RPi is received by the PIC at the correct moment. It turns out that the PIC did not receive the correct data that is suppose to be the instruction. Additional dummy data is sent from the RPi to cause the delay to have the instruction being send at the correct timing. After this is fixed, the PIC receive the correct data for the instruction and is able to write into the flash. But, in the end the RPi is sending an extra dummy byte to make sure that the instruction arrives the PIC at the correct timing.

After solving this, I try adding and removing dummy data sending process from the RPi while testing with ADC module to find out where does the problem occurs. It turns it is also an issue with the loop and the pattern of the data sent. The instruction byte is not taken by the PIC as the instruction byte and the process go haywire displaying “0b00 0b00” twice after every time the ADC value is shown. An extra dummy byte is also send from the RPi to make sure that the loop is getting the PIC to read from the correct bytes from the RPi. It is also should be noted that the extra bytes will only appear if the PIC runs the function adcSPI() to simulate the ADC, while if the PIC were to run the prototype version of the ADC code which is written in a main function, the extra bytes does not appear. I am guessing it is because the loop for both codes are a bit different which cause some bytes being sent at the wrong time.

Next, it is to try to speed up everything. Initially the code has delay to make the reading being displayed on terminal readable and also to help in knowing which part did the PIC is currently processing or stuck. By removing the delay from the RPi codes, the modules are still able to work correctly.

Categories: Experiential


Leave a Reply

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