Could someone help with the GPIFTCB setting found in the CY3686 firmware? I am new to cypress programming and studying the CY3686FW for use with CY7C68033. I found that, in inand.c's nReadPages() and nWritePages(), GPIFTCB is set to 511 (cNAND_DSIZE), instead of using the sector size which is 512. I wonder why it is so.
I have enclosed the inand.c and inand.h files from the CY3686FW. cNAND_DSIZE is defined at line 414 of inand.h
Thanks in advance.
If you look at the GPIF waveform, it transfers a byte and only then it goes to a state which checks TCxpire, this is the reason GPIFTCB is loaded with a value 1 less than the actual transaction count.
You can find the GPIF waveform in the file gpif30.gpf that comes as part of the project. If you're looking at NX2LP-Flex firmware you should find http://www.cypress.com/?rID=43431 useful.
Thanks. Does it mean if (1) is written to the count, 2 bytes will actually be read/written? It seems different from the description given in the USB TRM, e.g. from page 154-155 (figure 10-33 and figure 10-34) of the ezusb_trm (verD), an example is given for FIFO read transaction: to read a packet of HSPKTSIZE (512), 512 is written to GPIFTCB via the function call Peripheral_SetGPIFTC(). Also on figure 10-48, 10-49, 10-50, for FIFO write operation, 512 is used, not 511. I wonder if the ezusb_trm is wrong?
No. The TRM is right.
It depends on the GPIF waveform, here we are starting to check and decrement only after transferring a byte so the GPIFTCB comes into picture only after we've transferred 1 byte hence the value 511.