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

PWM connected LEDs pulse when sending SPI commands to ili9341 LCD #2675

Closed
horendus opened this issue Nov 9, 2016 · 5 comments
Closed

PWM connected LEDs pulse when sending SPI commands to ili9341 LCD #2675

horendus opened this issue Nov 9, 2016 · 5 comments

Comments

@horendus
Copy link

horendus commented Nov 9, 2016

Please fill the info fields, it helps to get you faster support ;)

if you have a stack dump decode it:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.md

for better debug messages:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.md

----------------------------- Remove above -----------------------------

Basic Infos

Hardware

Hardware: ESP-12E
Core Version: 2.1.0-rc2

Description

I have connected an ili9341 2.8inch LCD display to a ESP8266 (NodeMCU Board) using SPI bus.
I am driving the LED Backlight with a PWM signal from pin16 which works well until I lower the PWM value down to about 50% to dim the screen.

On the LCD I have the TIME updating every second. Every time the screen updates to re draw the second (only that section is re drawn not whole screen) it also causes the backlight to pulse. It doesnt appear to do with when the screen is at high brightness level (PWM 1023).

My theory is that using the SPI bus causes disruption to the PWM signal. Is this a know issue?
Is there a work around?

I plan to try this library out tonight to see if it makes a difference.
https://github.com/StefanBruens/ESP8266_new_pwm

Settings in IDE

Module: NodeMCU v1.0
Flash Size: 4MB
CPU Frequency: 120Mhz
Flash Mode: qio
Flash Frequency: 40Mhz
Upload Using: SERIAL?
Reset Method: nodemcu

(This isnt the real sketch as its over 8,000 lines over 10 .ino files but its just an example of how I am setting the PWM backlight control)

Sketch

#include <Arduino.h>
int backlight = 16
void setup() {
pinMode(backlight ,OUTPUT);
digitalWrite(backlight, 400);
}

void loop() {

}


### Debug Messages

messages here



@tablatronix
Copy link
Contributor

Have you tried another pin ?

@horendus
Copy link
Author

The work around I used was to switch to D16 for PWM signal because after checking with an oscilloscope it was the only pin which generated a stable signal without a 20mv flicker at the time of heavy SPI usage (such as screen draws)

I tried PWM with D0, D10 andD16 as they were the only pins I could make available in my project, the rest in use by various devices such as , RTC, ili9241 LCD, 2xRelays.

Anyone have a theory to why D16 is the only stable PWM pin when using heavy SPI?

@davidgevorgian
Copy link

I have the same problem last month. Try connected via a diode and a capacitor to the ground, see picture.
led_pmw

@davidgevorgian
Copy link

Look table below:
IO0 & IO10 used for SPI

image

HERE Espressif Recommendation for PWM: IO4,IO12,IO14,IO15

image

@devyte
Copy link
Collaborator

devyte commented Oct 10, 2017

@horendus the ESP has software PWM, not hardware. The most likely reason for the dimming is that interrupts get disabled and enabled during SPI comms, which can then affect the software PWM.
It's also possible that you have a power supply voltage dip, but in your case I think that's less likely.
Did you try out the other lib? Be aware that its licensing is different from that of this repo, so it can affect you if you intend to distribute the code.
About GPIO16, it has a pulldown, whereas all other GPIOs have a pullup. Not sure how that could affect, though.
I find this very interesting, but this is not the right place to discuss. Closing per #3655 .

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

4 participants