I received a CFAF240400DT, and I've had loads of fun getting it to work
.
I'm using your code as the base for my tests, and confirm that it isn't working. To facilitate testing, I have the mode select inputs on the display driven by port pins. As I was wiring the display to my AVR board, I noticed a discrepancy between the CFA data sheet and the SPFD5420 data sheet. The CFA sheet shows the I/F mode pins as "IM1", "IM0", and "ID". The SPFD5420 sheet show these, on pg 7, as "IM2", "IM1", and "IM0/ID". The "ID" function is an alternate use of IM0, only in serial mode, where IM0 becomes an input for the ID bit in the serial stream. So, I think the CFA data sheet is wrong, or at least very misleading, in its naming of these pins. I believe that the pins named IM1 is really IM2, IM0 is really IM1, and ID is IM0.
I set the mode to 010 for 16 bit, as shown on pg 7 of the SPFD5420 sheet, but that didn't help. Still no display. Then I tried mode 011 for 8 bit, and the display came to life and showed the expected color bands.
To troubleshoot the 16 bit mode problem, I made the display write functions be dynamically switchable between 16 bit (1 write) and 8 bit (2 writes), and brought in some functions from my CFAF320 code. Since 8 bit mode worked, I tried running up to the color band test in 8 bit mode, then switched to 16 bit mode to write the colors. That worked, but the colors were corrupted somewhat (in a very peculiar manner), indicating that 16 bit data writes are faulty, and thats why trying to initialize in 16 bit mode yielded no result. Next, I used my LCDRead() function to test what was being written to the display, all in 8 bit mode. For a reality check, I read the chip ID register (0), and got 0x5420. The SPFD5420 sheet, on pg 13, says 0x5408 will be read, but i think they used the 5408 data sheet as the basis for the 5420 sheet, and forgot to change the numbers in several places.
Next I wrote a series of 16 pixel patterns, a walking bit, from 0x0001, 0x0002 ... 0x4000, 0x8000. The 16 values that I read back all had 1 bit high, but the order was not the same, as though the data was shifted. I figured that it had something to do with the RGB bit order in the Entry Mode register (3). The init function writes 0x1030 to register 3, the BGR bit being high, causing the R and B colors to be swapped (to allow RGB entries, since BGR is the native sequence). I changed the init value to 0x0030, and the swapping went away, and the 16 pixel values came back exactly as written. This would only be important if you needed to do screen reads, like for screen block copies. Since the BGR sequence made the color definitions wrong, I had to redefine them with R and B swapped. Now the color bands are right again, and the reads are good.
Now, trying to write pixels in 16 bit mode, and read them back in 8 bit mode, to see whats the matter with the data. The data was corrupted, but I couldn't figure out how or why. Tried a lot of things, switching dynamically from 8 to 16 and back, to see if I could find a pattern to the corruption, but no dice. On a whim, I decided to try 18 bit (000) and 9 bit (001) modes, since the command bits are mapped the same as 8/16 bit. Surprisingly, 9 bit mode didn't work for 8 bit writes, but 18 bit mode worked for 16 bit writes. After trying these modes a bit more, I found that both 8 bit and 16 bit methods could be made to work.
modes 000 and 001 work as 16 bit transfers
modes 010 and 011 work as 8 bit transfers
This is definitely a conflict with the mode table on pg 7 of the SPFD5420 sheet. It seems that IM0 ("ID" in the CFA doc) is a "don't care", and IM1 (IM0 in the CFA doc) is the difference between 8 and 16 bit. I have no idea how 9 and 18 bit transfers are selected. Or maybe I'm using 9/18 and don't know it.
Full amplitude R G and B values look correct on the screen, but partial amplitude colors do not look right. I used a function from my CFAF320 code to write a gray scale ramp. On this display it was badly tinted with green and magenta. I thought it might be due to the gamma registers, so I commented out that part of the init sequence. That did not help. In fact, I commented out big chunks of the init function, with seemingly no ill effects. So I still haven't figured out the gray scale problem.
I am attaching my test code so you can get an idea of what I tried. It should work for you. You'll have to change the defines for port assignment and bit assignment.
BTW, I'm not seeing any problem running everything at 3.3 volts.