probonopd / MiniDexed

Dexed FM synthesizer similar to 8x DX7 (TX816/TX802) running on a bare metal Raspberry Pi (without a Linux kernel or operating system)
https://github.com/probonopd/MiniDexed/wiki
1.06k stars 76 forks source link

SSD1306 display misaligned when SoundDevice=i2s #397

Closed pegli closed 1 year ago

pegli commented 1 year ago

My MiniDexed build has been working great with PWM output. I added a PCM5102 DAC to my HAT, which is providing much better sound. When I enable it by setting SoundDevice=i2s in minidexed.ini, the SSD1306 display often shows a warped version of the menu or no menu at all:

IMG_2031

Switching back to SoundDevice=pwm fixes the behavior. The DAC model is HiLetgo PCM5102 I2S IIS High Quality Lossless Digital Audio DAC.

Banana71 commented 1 year ago

Hi @pegli,

can you copy your minidexed.ini here? I would check the following lines in the minidexed.ini:

"#Default is 16x2 display (e.g. HD44780) LCDColumns=20 LCDRows=2

Maybe an address conflict?! The DAC you use usually works perfectly.

pegli commented 1 year ago

Here are my 1306 settings:

# SSD1306 LCD
# For a 128x32 display, set LCDColumns=20; LCDRows=2
# For a 128x64 display, set LCDColumns=20; LCDRows=4
SSD1306LCDI2CAddress=0x3c
SSD1306LCDWidth=128
SSD1306LCDHeight=32

# Default is 16x2 display (e.g. HD44780)
LCDColumns=20
LCDRows=2

I also have DACI2CAddress=0, and both the DAC and the display are functioning correctly except for the misalignment.

I was also thinking that this might be an address conflict or a problem with DAC address detection. I'll boot the Pi into a desktop and see if I can find the address of the DAC, and maybe set it manually to see if that helps.

diyelectromusic commented 1 year ago

Hmm that's quirky, not quite sure why it would do that. Things I'd be trying:

That is all that springs to mind right now...?

pegli commented 1 year ago

Re the suggestions above:

  1. I definitely edited the minidexed.ini on the card. I've already been bitten by that mistake a couple of times. :)
  2. Tested with the SSD1306 display sample from Circle. Details below.
  3. Nope, no errors on the HDMI display, and both the DAC and the SSD are being detected.
  4. Issue was repeatable on three different display units.

I think the issue is the physical connection between the display and the HAT board I built. I thought that I might have mis-wired the SCK and SDA pins, so I plugged a ribbon cable in between the header and the display, thinking I would use the cable to swap the two pins and see if the problem still occurred. I used the Circle kernel image for testing. When the pins were swapped, nothing was displayed, so it looked to me like I had wired the header correctly. When I ran the cable straight from the display to the header, the Circle kernel ran several times as expected without distortion. I then booted from my Minidexed SD card and was no longer able to reproduce the distorted display problem, as long as I had the display connected to the board via the ribbon cable.

When I removed the cable and plugged the display straight into the header, the distortion came back...for a while. I eventually found a position of the display where I can repeatedly boot the Pi and not see distortion. My plan is to yank the header and put in a new one to see if that helps. The good news is that this doesn't seem to be a software or I2C issue, so I'm closing this ticket.

diyelectromusic commented 1 year ago

Sounds like you've been able to get some movement on this issue - well done! How's your electronics? I'm now wondering about things like:

I think we'd need to see some photos of your physical build to suggest anything else. But it sounds like you're making some progress now :)

Do let us know if you find out any more (and photos of your build are always welcome regardless!)

Kevin