Help me to connect oled SSD1309

edited September 2019 in Repetier-Firmware
Hello!
I ask for help in setting up Repetier-FW 1.0.4. I have a Ruramps v.1.3, DUE board. I am trying to connect oled SSD1309 to them with the SPI bus. There are no settings for this display in the uiconfig.h file.
Tell me how to configure soft_spi? As I understand it, the display must be turned on in this way. I would be grateful for your help.

Comments

  • You then need manual display configuration.

    #ifdef U8GLIB_SSD1306_SW_SPI
    u8g_InitSPI(&u8g, &u8g_dev_ssd1306_128x64_sw_spi, UI_DISPLAY_D4_PIN, UI_DISPLAY_ENABLE_PIN, UI_DISPLAY_RS_PIN, U8G_PIN_NONE, U8G_PIN_NONE);
    #endif

    is the crucial part in ui.cpp that initializes display. So you need to define U8GLIB_SSD1306_SW_SPI as display driver and set the defines used correctly. uiconfig.h describes what settings have which meaning so should be doable.
  • in the initialization line u8g_InitSP ..... at the end there are two NONE-pins. As I understand it, this is the purpose of the D / C and RESET pins for the display. Do these pin numbers need to be specified in uiconfig.h? in what form do this?
  • No, if there is explicit U8G_PIN_NONE you can not specify it. Hope they are really not required. Otherwise replace it with the value you need. But reset is never set for all displays. 
  • During tests of my display on Arduino Nano, I had to forcibly specify a RESET pin in the examples. Without it, the display refuses to work.
  • edited September 2019
    Anyway, I don’t understand something. Here is the code from the example:
    U8GLIB_SSD1306_128X64 u8g (4, 5, 6, 7, 8); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7, RES = 8
    I had to add the RES pin to make the display work. This code works.

    in the ui.cpp file, I brought the lines to the following form:
    #if UI_DISPLAY_TYPE == DISPLAY_U8G
    // u8glib
    #if defined (U8GLIB_ST7920) || defined (U8GLIB_SSD1306_SW_SPI)
    #define UI_SPI_SCK UI_DISPLAY_D4_PIN
    #define UI_SPI_MOSI UI_DISPLAY_ENABLE_PIN
    #define UI_SPI_CS UI_DISPLAY_RS_PIN
    #define UI_SPI_DC UI_DISPLAY_D5_PIN
    #endif
    .........
    #ifndef UI_DISPLAY_RESET_PIN
    #define UI_DISPLAY_RESET_PIN UI_DISPLAY_D7_PIN
    #endif
    .........
    #ifdef U8GLIB_SSD1306_SW_SPI
        u8g_InitSPI (& u8g, & u8g_dev_ssd1306_128x64_sw_spi, UI_DISPLAY_D4_PIN, UI_DISPLAY_ENABLE_PIN, UI_DISPLAY_RS_PIN, UI_DISPLAY_D5_PIN, UI_DISPLAY_D7_PIN);
    #endif
    .........
    In the uiconfig.h file, I uncommented:
    #define U8GLIB_SSD1306_SW_SPI

    The code compiles successfully, but the screen still doesn't work. What am I doing wrong?
  • edited September 2019
    Little by little I begin to understand what the problem is. My display supports 4-ware SPI interface. The ability to make a 3-ware interface is missing, there are no jumpers on the display board. so you need to somehow teach my Repetier to communicate with SSD 1309 on four wires. So far, I have no clarity in the future.
  • Only know 3 wire - MISO/MOSI/SCK - what is the 4th wire for? or is it slave select? But that is already one of the pins.

  • edited September 2019
    in the specification of the SPI protocol, this pin is mentioned (or rather, in the description of displays). It is referred to as Date / Command. Here is what I found: 
    • When using the 4-wire SPI connection, Data/Command is an “out of band” signal that tells the controller if you’re sending commands or display data. This line is not a part of SPI and the library controls it with a separate GPIO pin. With 3-wire SPI and I2C, the Data/Command signal is sent “in band”.
    • The use of the terms 4-wire and 3-wire SPI are a bit confusing because, in most SPI documentation, the terms are used to describe the regular 4-wire configuration of SPI and a 3-wire mode where the input and output lines, MOSI and MISO, have been combined into a single line called SISO. However, in the context of these OLED controllers, 4-wire means 
  • It turned out for me to turn on the display. True, not as I wanted. I had to re-solder the jumpers, pull the RESET to VCC, the ill-fated DC pin to ground, and it worked on the IIC bus. I did not want to, but I have to. The idea was to combine the display and the encoder, a couple of buttons and connect it all with a cable from a single socket. It's a pity.
  • Looking into docs the last 2 parameter in init that were none are a0 and reset. Not sure if a0 would be dc. But glad you figured out at least a solution.
  • it turns out that the limitations are imposed by the u8glib ex.h library. Interestingly, is there an opportunity in the future to finalize it? It seems to me that DC = A0. I already got confused ..... But, if this were true, then the display would connect without problems.
  • u8g development is discontinued. Updates are now in u8g2 lib the next version. Our V2 firmware uses the new library already, but configs are only for a few combos working a sit is in early development stage.
  • I looked at the firmware development branch of version 2. Among the boards, I found RuRamps4d, the owner of which I am, which is good news. It will be necessary to try to study this development branch. True, there is a lot of obscurity for me.
  • I don't have that board and I haven't added any displays to it, but you can check on radds board how I would do it if you like to play.
Sign In or Register to comment.