Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSD1306 OLED emulation ? #3

Open
penfold42 opened this issue Sep 21, 2019 · 5 comments
Open

SSD1306 OLED emulation ? #3

penfold42 opened this issue Sep 21, 2019 · 5 comments

Comments

@penfold42
Copy link
Contributor

Is this under consideration for a future release ?

@keirf
Copy link
Owner

keirf commented Sep 21, 2019

Yes this is interesting though there are two reasons I went for LCD in the first place:

  1. I can pick a suitable OSD font. 8x8 fonts seem to work well, the taller fonts used for OLED displays may not look so good (but I haven't tried them).

  2. I2C DMA transfers seem to cause occasional glitches in the OSD. I think this is because the start time of the Display-Output DMA is critical and it can be delayed if an I2C DMA transfer has already just begun. OLED I2C is run by FlashFloppy at 4x the LCD data rate. This may case 4x the glitches, and that may be unacceptable. Again, I haven't tried it to actually find out.

It's something to try as an experiment in due course and see how it goes.

@keirf
Copy link
Owner

keirf commented Sep 21, 2019

Some thoughts on issue 2. Perhaps I2C DMA can be paused for a short time (eg <10us) at the critical point on each scan line. eg. Set up a TIM2 or TIM3 channel in output-compare mode, and enable IRQ on compare-match. This could IRQ eg 2-3us before the OSD box, where we disable I2C DMA. Now we can either spin for eg 6us, or retask TIM1 to interrupt us again.

Former is easier but note that CPU activity can also jitter the OSD (bus-matrix contention presumably).

One possible solution: After disabling DMA, reprogram TIM1, then trigger a slightly lower-pri IRQ. This IRQ handler can WFI until TIM1 fires.

This is all subject to confirmation that I2C DMA can be safely paused at all. I have noticed when trying this before that subsequent DMA transfers are corrupted, but possibly disabled DMA for too long.

@penfold42
Copy link
Contributor Author

Item 1 - you could double the image in the X direction as an option ?

@keirf
Copy link
Owner

keirf commented Sep 21, 2019

Issue 2 is now completely fixed:

  1. Now use IRQ rather than DMA for the I2C transfers. This is resilient to transfers being slightly delayed.
  2. High-priority IRQ (higher priority than I2C IRQ) triggers 1us before the OSD box and holds the CPU for 1-2us while the critical DMAs are triggered.

@keirf
Copy link
Owner

keirf commented Sep 26, 2019

FF OSD now works alongside an existing OLED quite happily at 400kHz rate. Driving bitmap data to FF OSD at that rate would not be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants