Need advice about decoding ST7920 commands
Posted: Sat Jan 16, 2021 3:13 am
Hi,
I recently made a OLED emulator, want to make one for the ST7920 LCD (AKA RepRapDiscount Full Graphic Smart Controller), SPI mode. The OLED protocol was very simple (reason why I started with...), the ST7920 is much more complex !
The datasheet is really unclear to me. For now, much of my knowledge is based on this : https://controllerstech.com/glcd-128x64 ... ith-stm32/
It's been a great help.
Please remember it is NOT about displaying on the LCD. It's about sniffing the SPI master, turning the data into bitmaps with a STM32, and displaying them real time on a RasPi.
But for now I've to understand the commands format.
In order to understand, I modified some functions from https://controllerstech.com/glcd-128x64 ... ith-stm32/ so they output formated HEX to a console. Every command begins with a sync byte (0xF8), and is followed by two bytes (the command). See the fist paragraph : "Sending Command"
But it is NOT what I see with the logic analyser ! For example, in the initialization sequence I'm sniffing from Marlin + u8glib, I see 0xF8 followed by 5 pairs of bytes. So, There's no need for a 0xF8 for every command ?
This initialisation sequence makes sense... Decoding it on the paper with the datasheet, I read :
cmd 0x38 (= 8bit, basic set of instructions) / cmd 0x0C (= display ON) / cmd 0x06 (= Entry mode with I/D and no S) / cmd 0x02 (home) / cmd 0x01 (clear)
(command bits are shifted as explained in the datasheet - I don't konw why, maybe because it's easier for the ST7920 and its shift registers...)
Does this make sense for you : one F8 byte only + a series of commands. I've a hard time because the datasheet is unclear to me : it mixes parallel and series protocols, and is not really untertaining ! And obviously, nowhere functions are listed as numbers : they are defined by name, with the bits to be set. I've to do the exact opposite.
I recently made a OLED emulator, want to make one for the ST7920 LCD (AKA RepRapDiscount Full Graphic Smart Controller), SPI mode. The OLED protocol was very simple (reason why I started with...), the ST7920 is much more complex !
The datasheet is really unclear to me. For now, much of my knowledge is based on this : https://controllerstech.com/glcd-128x64 ... ith-stm32/
It's been a great help.
Please remember it is NOT about displaying on the LCD. It's about sniffing the SPI master, turning the data into bitmaps with a STM32, and displaying them real time on a RasPi.
But for now I've to understand the commands format.
In order to understand, I modified some functions from https://controllerstech.com/glcd-128x64 ... ith-stm32/ so they output formated HEX to a console. Every command begins with a sync byte (0xF8), and is followed by two bytes (the command). See the fist paragraph : "Sending Command"
But it is NOT what I see with the logic analyser ! For example, in the initialization sequence I'm sniffing from Marlin + u8glib, I see 0xF8 followed by 5 pairs of bytes. So, There's no need for a 0xF8 for every command ?
This initialisation sequence makes sense... Decoding it on the paper with the datasheet, I read :
cmd 0x38 (= 8bit, basic set of instructions) / cmd 0x0C (= display ON) / cmd 0x06 (= Entry mode with I/D and no S) / cmd 0x02 (home) / cmd 0x01 (clear)
(command bits are shifted as explained in the datasheet - I don't konw why, maybe because it's easier for the ST7920 and its shift registers...)
Does this make sense for you : one F8 byte only + a series of commands. I've a hard time because the datasheet is unclear to me : it mixes parallel and series protocols, and is not really untertaining ! And obviously, nowhere functions are listed as numbers : they are defined by name, with the bits to be set. I've to do the exact opposite.