Jump to content

7 pin OLED 1306 SPI display not working? :(


tonedef
 Share

Recommended Posts

Finally got the dust off of my STM32F4 board to work on a project I started 3 years ago. Sad news, I cannot get these OLED displays working. They're factory wired for 4SPI, which I tried initially and no dice. Realized they might need to be I2C (IIC), so I moved/added the SMD resistors for that, but still no dice. Blank.

Also edited the DEFAULT.NGC file to add:

RESET_HW

LCD "%C"
LCD "@(1:1:1)OLED1"
LCD "@(2:1:1)OLED2"
LCD "@(3:1:1)OLED3"
LCD "@(4:1:1)OLED4"
LCD "@(5:1:1)OLED5"
LCD "@(6:1:1)OLED6"
LCD "@(7:1:1)OLED7"
LCD "@(8:1:1)OLED8"

Been several years since I've played around with building a MIDIBox project, and the last one was a LPC17 so I'm admittedly rusty as well as new to the STM32F4 board. What am I missing? Also, LD1/COM LED onthe STM32F4 board is red and blinks, is that normal? For what it's worth, the displays I am able to get working in Arduino projects, so it must be something I'm not doing right here.

 

IMG-4491.jpg

Edited by tonedef
Link to comment
Share on other sites

Oh, wow, I totally missed that! Thank you!!! I wasted an entire day rummaging around and didn't manage to see that :)

 

Just in case others run across this:

  • You want 4SPI configuration, not IIC like I have in the pic.
  • The number of screens you have must match the configuration you set in the bootloader, otherwise you get noise, and won't be able to write to all the lines/columns
  • Also easy to miss, but for the 1306 RES connection, you need to wire it up like this (again, connections on your 1306 PCB): GND -> 10uf cap -> 1k resistor -> VCC. Once done, RES will be tied to where the cap and resistor meet (like this)

It wasn't clear to me how to actually use the bootloader for the STMF4 board, but it's essentially:

  • Plugin your board as you normally do
  • Open MIOS Studio
  • Click Browse and choose the mios32_bootloader app (download here)
  • Click Start. If it won't complete, try unpluging/pluging the board and trying again
  • Unplug/plugin the board
  • In the MIDI IN and MIDI OUT sections whatever app you had prior to all of this might be listed, but it doesn't actually exist (and it shouldn't). That's why you now see the error "No response...".  The new app, MIOS32, took its place and you need to refresh to see it.
  • Click Application -> Rescan MIDI Devices
  • Click Understood in the pop-up (this will make your old app disappear, and the MIOS32 app show up)
  • Change MIDI IN and MIDI OUT to MIOS32 
  • Enter these one by one into the input box: (send a command to MIOS32 application). Keep in mind lcd_num_x must match the number you have chained:
    set lcd_type GLCD_SSD1306
    set lcd_num_x 1
    set lcd_num_y 1
    set lcd_width 128
    set lcd_height 64
    store

Yah. Bootloader is done. Time to restore your app in MIOS Studio:

  • Click Browse and choose whatever app you want, like midibox_ng
  • Click Start. Like the bootloader, if it won't complete, try unpluging/pluging the board and trying again
  • Unplug/plugin the board

Now for some test display data. Lets set some values for your SSD1306 OLED's in MIOS Studio:

  • Click on Tools -> MIOS32 File Browser
  • Click Create File
  • Create some name like LCD.NGC
  • Click Update
  • Click on the file you just created
  • Click Edit Text and add the following test example:

    RESET_HW

    LCD "%C"
    LCD "@(1:1:1)A23456789012345678901234567890"
    LCD "@(1:1:2)B23456789012345678901234567890"
    LCD "@(1:1:3)C23456789012345678901234567890"
    LCD "@(1:1:4)D23456789012345678901234567890"
    LCD "@(1:1:5)E23456789012345678901234567890"
    LCD "@(1:1:6)F23456789012345678901234567890"
    LCD "@(1:1:7)G23456789012345678901234567890"
    LCD "@(1:1:8)H23456789012345678901234567890"

  • Click Save

You should now have 8 rows and 21 columns of text. If you need to flip it 180 degrees, you can redo the steps above and add set lcd_type GLCD_SSD1306_ROTATED  before you store.

 

IMG-4496.jpg

Edited by tonedef
Link to comment
Share on other sites

The only other question I have is can I rotate this 90 degrees instead of just 180? My current thought as a workaround is to create a font set that's rotated 90 degrees and write out lines a single letter at a time:

LCD "@(1:1:3),"
LCD "@(1:1:4)o"
LCD "@(1:1:5)l"
LCD "@(1:1:6)l"
LCD "@(1:1:7)e"
LCD "@(1:1:8)H"

LCD "@(1:2:2)."
LCD "@(1:2:3)d"
LCD "@(1:2:4)n"
LCD "@(1:2:5)e"
LCD "@(1:2:6)i"
LCD "@(1:2:7)r"
LCD "@(1:2:8)f"

 

It'd look like this, but you have to imagine all the letters are rotated counter clockwise by 90 degrees:

IMG-4497.jpg

Edited by tonedef
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...