drewsum / Electronic_Display

320x256 LED Display, Marquette Senior Design Project E44
4 stars 1 forks source link

EBI #60

Closed drewsum closed 5 years ago

drewsum commented 5 years ago

Write external bus interface module for interfacing PIC32MZ with external SRAM. Using data line 0:8, address lines 0:17. No idea what speed settings should be. SRAM size is 256k x 8b

drewsum commented 5 years ago

Ideas for this:

Slow down EBI to slowest setting and we'll work our way up from there: TPRC, TBTA and all other bit fields in the EBISMT0 register should be set to all 1's instead of all 0's

Keep following example 47-5 in the EBI reference manual: Keep copying over the example code for the ebiInitialize function, but when they write something like EBISMCON = 0x00000000, instead of just writing that, write zero's or whatever into the actual bitfields so we know explicitly what we're configuring instead of writing a 32-bit number into a register

Write an ebiTestRamBuffer() Function: Prototype in the ebi header file, and write the function in the ebi source file. Use a for loop to loop through all possible addresses in external memory (0 to 2^17 - 1 or something like that) and write the address into that memory location. The data is accessed through a pointer if I remember right. Then, loop through the array again and verify that the data matches what you set it to for each address. If it does, print out that no errors occurred, if there is an error, print an error message.

Write an ebiPrintSRAM() Function: prototype in the ebi header file and write in the ebi source file. It should loop through all EBI addresses lik ethe test function above, but instead of writing and checking to verify it wrote properly, it should print out the SRAM register address and contents of the SRAM register. To keep the output shorter, I would say print like 16 bytes of data per line or something like this:

Address: 0 1 2 3 4 5 6 7 8 9 A B C D E F 0x0000000x 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0000001x 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ...

drewsum commented 5 years ago

We should also add a printEBIStatus() function to print out the settings of all EBI pins/control registers/whatever before we actually turn the EBI module on for the first time. This will help us make sure pins are set properly and reduce the risk of frying anything on the board

drewsum commented 5 years ago

We should also add checks in the beginning of the read and write functions to make sure input data/addresses are valid numbers

drewsum commented 5 years ago

I ran an EBI test for the first time, and every time the ebiTest() function is called a CPU general exception is thrown. I think this has something to do with a memory permissions error. This exception gets thrown because the EBI testing function is trying to read from external memory which it doesn't have permission to and therefore a read from a wrong address throws a CPU general exception. I think we have to configure the EBI memory space to be accessed by the CPU using the memory management unit. This cade should sit in the ebiInit() function. The MMU is outlined in section 48 of the REF manual for the 32MZ

drewsum commented 5 years ago

EBI virtual memory space starts at 0xC000 0000, and physical space starts at 0x2000 0000. The size of the EBI external SRAM is 256 * 1044 bytes, or 262144 bytes