heneault / yocto-pitrezor

raspberry pi zero platform to run the trezor port pitrezor as a bitcoin wallet
https://www.pitrezor.com
MIT License
116 stars 30 forks source link

How to add a screen? #6

Open Ph0rk0z opened 4 years ago

Ph0rk0z commented 4 years ago

The OLED recommended is over $32 at this stage. I bought a 256x256 SPi with identical footprint. How can I compile in support for it? The display can just be scaled, could it not?

It's this one: https://www.adafruit.com/product/4506

Ph0rk0z commented 4 years ago

Also, if you don't want to add a driver it might be possible to edit the pi image to mirror HDMI to this LCD: https://krystof.io/mirroring-raspberry-pi-hdmi-video-to-a-st7789-1-3-inch-lcd-display/

heneault commented 4 years ago

For the 256x256 lcd, scaling would probably look awful because the fonts and picture are designed to work in 128x64. However, maybe by modifying the code it could be possible to use a portion of the 128x64 display, leaving the remaining as black. For the hdmi to lcd I'm not quite sure it could work I think you can find other retailers less expensive than 32$. Here is one for instances : https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20200810043615&origin=y&SearchText=SH1106+oled+1.3

Ph0rk0z commented 4 years ago

Ali express is not so easy with the china situation. Yes it's cheap but maybe I'll see it in 2-3 months :(

Since I've already spent the $17 + $5 + $3 it would be nice if it could work (real trezor is ~$50). I definitely don't have the wherewithal to write the driver but if I could figure out how the pi kernel and extra software is built I could compile the program and just load ST7789 module from the kernel. This build in docker and yocto is very new to me.

Updating slow shouldn't be an issue and the HDMI can be marked to be always on as he said with hdmi_force_hotplug=1. Unless there is some other reason it doesn't work.

icefirex commented 4 years ago

I would like to know the same, I have a 1.3" 240x240 SPI Display (https://www.waveshare.com/1.3inch-lcd-hat.htm) Could you point me in the right direction what files we need to change and I can look at the code myself?

heneault commented 4 years ago

I can prepare a sample that stimulate only the oled so that you can modify/compile/test it directly without docker and the whole build system.

icefirex commented 4 years ago

Absolutely. That would be soo highly appreciated, I already found drivers and code for the chipset display board I'm using and it should be a good thing for me to implement.

Ph0rk0z commented 4 years ago

Also, thanks. I was going to test the kernel driver on regular raspbian and see if it all worked with hdmi unplugged as a way to bootleg it and check CPU load/etc. This seems better.

BTW: I think the code for the LCD control was here: https://github.com/heneault/trezor-firmware/tree/pitrezor/legacy/emulator/pizero

heneault commented 4 years ago

ok. I will prepare for next week

heneault commented 4 years ago

I added a sample that test my oled driver. It just initialize the oled and display the trezor logo on it. I tested it on raspios buster lite version but should work with other flavor of raspios too. Here is the instruction to play with it:

# install bcm2835 library
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
tar zxvf bcm2835-1.60.tar.gz 
cd bcm2835-1.60
sudo ./configure
sudo make && sudo make check && sudo make install

# clone project and run sample
git clone https://github.com/heneault/trezor-firmware.git
cd trezor-firmware/legacy/emulator/pizero/sample
nano test_oled.c # Update OLED_TYPE and FLIP variables
make
sudo ./test_oled

To support a new oled device, you will have to modify the oled_drivers.c file (and add a new entry in the oled_drivers.h) . Don't modify the size of the buffer (128x64) in test oled.c . It must remains like this to be aligned with the original trezor firmware. You will have to do the manipulation in oled_drivers.c only.

I suggest that you begin by finding a demo program that show something on your oled. Then you should be able to migrate the spi/i2c commands used to the oled_drivers.file structure.

UncleSamKuia commented 3 years ago

Absolutely. That would be soo highly appreciated, I already found drivers and code for the chipset display board I'm using and it should be a good thing for me to implement.

Hello, Okay? Were you able to resolve the issue? I really have a problem.

Lanson2232 commented 3 years ago

Does this project work with SSD1306 Driver chip? the display works fine with my Arduino project but if I use it on raspberry pi 0 with the Library I don't get any kind of picture and the test above doesn't work I the type doesn't exists?

heneault commented 3 years ago

I think the SD1306 should work with the proper setting. Check if it is properly soldered and if you soldered it to the proper pins

Lanson2232 commented 2 years ago

@heneault I'm a little confused, I've tried everything possible but it doesn't work. may the problem be that the screen is blue-black? does this project support other colors on screen?

heneault commented 2 years ago

Do you which i2c address it uses with the arduino ? Do you have a link to manufacturer ?

Lanson2232 commented 2 years ago

The I2C adress is 0x3C I buyed the screen from robolinkmarket.com (it's a turkish electronic parts seller)

Information about this product:

Driver Chip : SSD1306 Interface Type :IIC/I2C Working Voltage: 3.3-5V Resolution : 128x64 Display Size : 0.96inch Color : Blue (Background: Black) Size: 27.5x28.5mm

heneault commented 2 years ago

Everything look good. Can you double check if it is connected like the diagram on pitrezor.com ? Maybe you can test on another pi zero if possible ?

beatstick commented 2 years ago

Hi, I've got the same problem. I set display OLED_ADAFRUIT_I2C_128x64 = 1 in pitrezor.config. I tried all other i2cs as well. I still get not picture on the screen. I bought this display from ebay: https://www.ebay.de/itm/353351582659

I soldered it twice with two sets of wires and also replaced the display, because I thought it was broken.

Edit:

Oh, forget about this, I connected Ground to the wrong pin! Still, it would be useful information for some, that you need to chose the adafruit OLED in the config if you are using an SSD1306.

nathanjnorris commented 2 years ago

@Ph0rk0z did you have any luck with the ST7789 driver?

3rdIteration commented 2 years ago

I have this working now with ST7789, basically mirroring the HDMI, so should easily be applicable to a range of other screens too. Will get it all done in a yocto friendly way and bring a PR in the next little while.

jpph commented 2 years ago

I have this working now with ST7789, basically mirroring the HDMI, so should easily be applicable to a range of other screens too. Will get it all done in a yocto friendly way and bring a PR in the next little while.

Looking for it with impatience

icefirex commented 1 year ago

I have this working now with ST7789, basically mirroring the HDMI, so should easily be applicable to a range of other screens too. Will get it all done in a yocto friendly way and bring a PR in the next little while.

Are you able to share this?

jpph commented 1 year ago

The PR is there. You can go to 3diteration's repo, he has all the images there ready to put on sdcard.

welltinho commented 8 months ago

Is there any way I can enable the RCA output? to connect to an old TV or an RCA screen from a car reversing camera