I usually go for 4 wire mode so that there is an explicit command/data control line, as the PIC32 does not really do 9 bit SPI which is the other choice if not doing parallel.
Aggravatingly, 320 * 240 * 16 is more then 128k, so you cannot hold a frame buffer in the pic without getting sneaky.
As to overall support, you might wish to use two or three microcontrollers instead of just one: one for video processing (blitter (https://en.wikipedia.org/wiki/Blitter), or graphics tile processor, as most games use sprites and tiles as the basis for their graphics), one for audio processing (if wavetable synthesis and/or MP3 decoding for music is supported), and the master one for the game mechanics.
If the TE signal is available on your screen (They vary) it is worth hooking this to an interrupt line.
There are a few technical tricks that one can do to make the scan rendering much easier and faster. The main one is to have your scan line buffer start at -N, and end at W+N-1, where N is the size of your largest tiles (N×N), and W is the width of the scan line. This way each sprite is either entirely visible on the scan line, or not at all.
You mean updating a section?I mean, if you use a tile blitter, you do not need a framebuffer at all. Instead, you construct each scan line separately, and send it to the display module.
Or are you trying to emulate old consoles?
I always have problems getting started and need some mental support.
mental support is about helping people with brain disabilitiesCambridge dictionary (https://dictionary.cambridge.org/dictionary/english/sustenance) disagrees. "To support" means to help or encourage, and "mental" means relating to the mind, or involving the process of thinking. Although there is no direct entry for "mental support", Cambridge dictionary implies "ILI9341 mental support" simply means "helping with the process of thinking [about] [how to use] an ILI9341 [display module]".
RoGeorge was not being negative. As a native speaker of English I find the phrase 'mental support' unusual and ambiguous. No native speaker uses it. People do use the phrase "emotional support" often, that directly means people sympathizing. Like when women gather and cry and hug each other and complain about men. I am going to guess Jan Audio didn't intend that meaning.mental support is about helping people with brain disabilitiesCambridge dictionary (https://dictionary.cambridge.org/dictionary/english/sustenance) disagrees. "To support" means to help or encourage, and "mental" means relating to the mind, or involving the process of thinking. Although there is no direct entry for "mental support", Cambridge dictionary implies "ILI9341 mental support" simply means "helping with the process of thinking [about] [how to use] an ILI9341 [display module]".
RoGeorge was not being negative.Neither was I. I only pointed out that for us non-native speakers, the dictionary implies a non-mental-health-related meaning.
// (Display off)
//hspi_cmd(SPIx, 0x28);
// Issue a series of initialization commands from the
// Adafruit library for a simple 'known good' test.
// (TODO: Add named macro definitions for these hex values.)
hspi_cmd(SPIx, 0xEF);
hspi_w8(SPIx, 0x03);
hspi_w8(SPIx, 0x80);
hspi_w8(SPIx, 0x02);
hspi_cmd(SPIx, 0xCF);
hspi_w8(SPIx, 0x00);
hspi_w8(SPIx, 0xC1);
hspi_w8(SPIx, 0x30);
hspi_cmd(SPIx, 0xED);
hspi_w8(SPIx, 0x64);
hspi_w8(SPIx, 0x03);
hspi_w8(SPIx, 0x12);
hspi_w8(SPIx, 0x81);
hspi_cmd(SPIx, 0xE8);
hspi_w8(SPIx, 0x85);
hspi_w8(SPIx, 0x00);
hspi_w8(SPIx, 0x78);
hspi_cmd(SPIx, 0xCB);
hspi_w8(SPIx, 0x39);
hspi_w8(SPIx, 0x2C);
hspi_w8(SPIx, 0x00);
hspi_w8(SPIx, 0x34);
hspi_w8(SPIx, 0x02);
hspi_cmd(SPIx, 0xF7);
hspi_w8(SPIx, 0x20);
hspi_cmd(SPIx, 0xEA);
hspi_w8(SPIx, 0x00);
hspi_w8(SPIx, 0x00);
// PWCTR1
hspi_cmd(SPIx, 0xC0);
hspi_w8(SPIx, 0x23);
// PWCTR2
hspi_cmd(SPIx, 0xC1);
hspi_w8(SPIx, 0x10);
// VMCTR1
hspi_cmd(SPIx, 0xC5);
hspi_w8(SPIx, 0x3E);
hspi_w8(SPIx, 0x28);
// VMCTR2
hspi_cmd(SPIx, 0xC7);
hspi_w8(SPIx, 0x86);
// MADCTL
hspi_cmd(SPIx, 0x36);
hspi_w8(SPIx, 0x48);
// VSCRSADD
hspi_cmd(SPIx, 0x37);
hspi_w8(SPIx, 0x00);
// PIXFMT
hspi_cmd(SPIx, 0x3A);
hspi_w8(SPIx, 0x55);
// FRMCTR1
hspi_cmd(SPIx, 0xB1);
hspi_w8(SPIx, 0x00);
hspi_w8(SPIx, 0x18);
// DFUNCTR
hspi_cmd(SPIx, 0xB6);
hspi_w8(SPIx, 0x08);
hspi_w8(SPIx, 0x82);
hspi_w8(SPIx, 0x27);
hspi_cmd(SPIx, 0xF2);
hspi_w8(SPIx, 0x00);
// GAMMASET
hspi_cmd(SPIx, 0x26);
hspi_w8(SPIx, 0x01);
// (Actual gamma settings)
hspi_cmd(SPIx, 0xE0);
hspi_w8(SPIx, 0x0F);
hspi_w8(SPIx, 0x31);
hspi_w8(SPIx, 0x2B);
hspi_w8(SPIx, 0x0C);
hspi_w8(SPIx, 0x0E);
hspi_w8(SPIx, 0x08);
hspi_w8(SPIx, 0x4E);
hspi_w8(SPIx, 0xF1);
hspi_w8(SPIx, 0x37);
hspi_w8(SPIx, 0x07);
hspi_w8(SPIx, 0x10);
hspi_w8(SPIx, 0x03);
hspi_w8(SPIx, 0x0E);
hspi_w8(SPIx, 0x09);
hspi_w8(SPIx, 0x00);
hspi_cmd(SPIx, 0xE1);
hspi_w8(SPIx, 0x00);
hspi_w8(SPIx, 0x0E);
hspi_w8(SPIx, 0x14);
hspi_w8(SPIx, 0x03);
hspi_w8(SPIx, 0x11);
hspi_w8(SPIx, 0x07);
hspi_w8(SPIx, 0x31);
hspi_w8(SPIx, 0xC1);
hspi_w8(SPIx, 0x48);
hspi_w8(SPIx, 0x08);
hspi_w8(SPIx, 0x0F);
hspi_w8(SPIx, 0x0C);
hspi_w8(SPIx, 0x31);
hspi_w8(SPIx, 0x36);
hspi_w8(SPIx, 0x0F);
// Exit sleep mode.
hspi_cmd(SPIx, 0x11);
delay_cycles(2000000);
// Display on.
hspi_cmd(SPIx, 0x29);
delay_cycles(2000000);
// 'Normal' display mode.
hspi_cmd(SPIx, 0x13);
The chip is PIC32MX170F256B, it should have everything on board.21 I/O pins is a restriction. The -D model, TQFP-44, would have been much easier, even if on an TQFP-44 to DIP adapter.
This 3,2 inch display with parralel has a 2 row pin header, i need to add wired, thats why i favored the SPI, i can plug in breadboard.Note that most of the ILI9431 displays' boards are just connectors, with some passives like resistors, and possibly a 3.3V regulator, and rarely voltage level translators so that 5V systems can talk to the 3.3V logic the ILI9431 uses. 32-bit microcontrollers typically use 3.3V logic levels, so they don't need level shifting. You could probably rather easily design a replacement board for the display with your graphics microcontroller, so that the microcontroller pins go directly to the display flex cable. The ILI9431 chip itself is usually bonded to the flex cable.
I try getting the SPI working first, then i can see later for fast redraw.
For tetris and arknoid regions can be updated no problem.The technique to track which parts of the display have changed is often called "damage". Essentially, you use one bit per a fixed size unit/tile of the framebuffer, and whenever you draw to the framebuffer, you mark the tile the pixel(s) belong to used by setting the corresponding bits.
(I have a couple of those displays, with a resistive touchscreen on top. The SD card connector on them is usually not worth trying to use; I think the traces pick up too much noise from the actual display or something.)
For ILI9431, setting the region to be updated by consecutive data sent to the display takes 10 bytes or pixels worth of data. The D/CX pin controls whether a command or data is sent, so data and commands may be impossible to mix in DMA transfers; you'll need at least an interrupt in between to flip the D/CX pin.
Thanks for your mega-reply again.It's just my verbose output, can't help it. Some dislike it a lot; I'm glad you find them helpful.
I was counting pins, and can go for the 16-bit parralel mode, then i have PORTB for the 16 bits, and PORTA for the strobe + DC and UART.What development environment (compiler and libraries) are you using?
For now i am trying the SPI version, and i can not get any result, i copyd all the initialize codes and it wont work.
| Pin | Description | Pin | Description | Pin | Description |
| 1 | GND | 7 | SDO | 13 | LED-3 |
| 2 | /RESET | 8 | GND | 14 | LED-4 |
| 3 | SCL | 9 | VDD | 15 | XL (Touch) |
| 4 | RS | 10 | LED+ | 16 | YU (Touch) |
| 5 | /CS | 11 | LED-1 | 17 | XR (Touch) |
| 6 | SDA | 12 | LED-2 | 18 | YB (Touch) |
| Pin | Description | Pin | Description | Pin | Description |
| 1 | GND | 13 | D4 | 25 | GND |
| 2 | VDD | 14 | D5 | 26 | Y- (Touch) |
| 3 | VDD | 15 | D6 | 27 | X- (Touch) |
| 4 | /CS | 16 | D7 | 28 | Y+ (Touch) |
| 5 | C/D | 17 | D8 | 29 | X+ (Touch) |
| 6 | WR | 18 | D9 | 30 | LED-1 |
| 7 | RD | 19 | D10 | 31 | LED-2 |
| 8 | /RESET | 20 | D11 | 32 | LED-3 |
| 9 | D0 | 21 | D12 | 33 | LED-4 |
| 10 | D1 | 22 | D13 | 34 | LED-5 |
| 11 | D2 | 23 | D14 | 35 | LED-6 |
| 12 | D3 | 24 | D15 | 36 | LED+ |
| 37 | GND |
O no, now my plan falls in the water, that is the nice part about these displays.Eh? PIC32MX and PIC32MZ both use 3.3V signal levels (although some pins are 5V tolerant), so you can just wire a microSD card connector directly to the microcontroller pins. No components of any kind needed:
| MicroSD Pin | Description (SPI mode) | Connect to PIC32 |
| 1 | NC | No connection |
| 2 | /CS | SPI Chip Select pin |
| 3 | DI | SPI MOSI (data out on PIC32) pin |
| 4 | VDD | 3.3V |
| 5 | CLK | SPI Clock pin |
| 6 | VSS | GND |
| 7 | DO | SPI MISO (data in on PIC32) pin |
| 8 | RV | No connection |
Yes. That is, sending small damaged regions is not fast because the overhead is large, about 10 pixels, but also stops DMA. If you use DMA for receiving data from the master processor, so the graphics processor main routines work on processing and sending the data to the display module (interspersed with parsing and handling the commands from the master processor from already-received buffers), then it matters less; really, only about 11 pixels. So in that case, 4×4-pixel damage regions might work even better, although then the math gets nastier (as you need more than one word for all damage bits in one row/column of the display, increasing the "cost" of marking damage)... so maybe 8×8-pixel damage regions work better for 320x240 displays.For ILI9431, setting the region to be updated by consecutive data sent to the display takes 10 bytes or pixels worth of data.So the best is to keep it running.
There is for example QFP44 0.8mm pitch to 44-pin DIP adapter, 5 adapters for 3.77€ (https://www.ebay.com/itm/5pcs-QFP44-SMD-SMT-Pin-Pitch-0-8mm-IC-to-DIP-44-Adapter-PCB-Board-Converter-F54/181333858466), although you need to use both straight and bent (90 degree) male pin headers, as there is no room for the middle ten pin holes. The pads are wide enough for bent pins. Just solder the holed ones first, then place the bent pins roughly at the right positions, attach female pin headers to the pins so they align the bent male pins, apply flux, and solder the bent pins in place. Easy-peasy. I would solder and clean and inspect the pins before soldering the chip.
I would like female headers on the MCLR and programming pins, then those pins no need for as i/o, also can combine + and - add ceramic caps,Exactly; and that isn't at all hard to do in EasyEda, KiCad etc.
crystal also nice, internal will do, at the end you have a normal chip again fully functional.
I mean : cant you make it less skinny so the whole thing is 1 row bigger ?, instead of SPDIP-40 do DIP-40.Of course, but then there is really not much room on the breadboard left (one row on each side), so it would make more sense to just use male pins on it anyway, in any shape. Instead of male-male jumpers, you'd use male-female ones. There doesn't seem much sense for the board to sit on the breadboard if only one pin is exposed on either side!
| TFT pin | PIC32 pin | Purpose |
| REST | Any output pin | Reset. When pulled LOW/0 for a few milliseconds, the display is reset. During normal operation, keep HIGH/1. |
| CS | Any output pin | Chip Select. TFT only cares about other pins (except REST) when this is LOW/0. |
| RS | Any output pin | Register/Data. This is LOW/0 for the command byte, HIGH/1 for parameters and pixel data. |
| WR | Any output pin | Write strobe. The TFT will latch data pins on a rising edge (LOW/0 to HIGH/1). |
| RD | Any output pin | Read strobe. The TFT will start setting up the data pins on a falling edge (HIGH/1 to LOW/0), and the MCU is supposed to latch the data pins on a rising edge (LOW/0 to HIGH/1). |
| DB0..DB7 | Low 8 I/O pins | Pins used for commands and parameters; and five blue bits and three least significant green bits for pixel data. |
| DB8..DB15 | High 8 I/O pins | Pins used for the three most significant green bits and five red bits for pixel data. |
| GND | GND | Ground |
| VCC | 3.3V | Bridge the J1 pads near the 3-pin voltage regulator. This ensures the logic levels do not exceed 3.3V. |
Why would you want to receive ?At the initialization stage, you can obtain the display ID; that way the same microcontroller/board firmware can support multiple near-compatible displays.
btw : 10 dollar for a DIP converter is to much.Zwei isn't a DIP converter, it is a full development board for 64-pin TQFP PIC32MZ's.
No chance for errors when CS tied to ground then?Not really, even the datasheet says you can tie CS to ground.
I am going for a tiled graphics processor, i hope the UART input will be fast enough for a simple game.You should be able to use 2Mbaud for example; that translates to 200,000 bytes per second. Even higher baud rates are possible too.
I was reading this PIC32 datasheet and read about the : Parallel Master Port, i wonder how it can help me ?The Parallel Master Port documentation for PIC32 microcontrollers is here (http://ww1.microchip.com/downloads/en/DeviceDoc/60001128H.pdf).
| Use | Possible pins (excluding Bn) | |
| UART1 RX | A4, C1, C3, C6 | |
| UART1 TX | A0, C0, C5, C7 | |
| UART2 RX | A1, A8, A9, C8 | |
| UART2 TX | C2, C4, C9 | |
| INT1 input | C2, C4, C9 | |
| INT2 input | A4, C1, C3, C6 | |
| INT3 input | A1, A8, A9, C8 | |
| INT4 input | A0, C0, C5, C7 | |
| Timer2 clock input (T2CK) | A0, C0, C5, C7 | |
| Timer3 clock input (T3CK) | A1, A8, A9, C8 | |
| Timer4 clock input (T4CK) | A4, C1, C3, C6 | |
| Timer5 clock input (T5CK) | C2, C4, C9 | |
| Output compare 1 (OC1) | A0, C0, C5, C7 | |
| Output compare 2 (OC2) | A1, A8, A9, C8 | |
| Output compare 3 (OC3) | C2, C4, C9 | |
| Output compare 4 (OC4) | A4, C1, C3, C6 | |
| Output compare 5 (OC5) | A4, C1, C3, C6 | |
| SPI1 data output (SDO1) | A1, A8, A9, C1, C3, C6, C8 | |
| SPI2 data output (SDO2) | A1, A8, A9, C1, C3, C6, C8 |