ESP8266 Developer Zone The Official ESP8266 Forum 2015-11-01T03:33:10+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=631 2015-11-01T03:33:10+08:00 2015-11-01T03:33:10+08:00 https://bbs.espressif.com:443/viewtopic.php?t=631&p=4398#p4398 <![CDATA[Re: PWM and SNTP issues]]> Statistics: Posted by tprochazka — Sun Nov 01, 2015 3:33 am


]]>
2015-06-24T15:31:10+08:00 2015-06-24T15:31:10+08:00 https://bbs.espressif.com:443/viewtopic.php?t=631&p=2385#p2385 <![CDATA[Re: PWM and SNTP issues]]> I've adjusted the period to 1000us.
I accept current limit of 90% or thereabouts duty cycle.

HOWEVER... given code that runs a callback to update a serial LED... once you start PWM, even then setting PWM to 0,0,0 something has CHANGED which stops the high speed serial LED from operating properly.

Here is the code for the Serial LED, called at regular intervals in a callback function, you can get serial LEDS to respond utterly reliably, but NOT once the PWM has been started. Hence it would seem we still need a proper PWM.STOP function.



void SEND_WS_12_0() {
SET_PERI_REG_MASK(PERIPHS_GPIO_BASEADDR, wsBitMask);
__asm__ __volatile__ ("nop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop");
CLEAR_PERI_REG_MASK(PERIPHS_GPIO_BASEADDR, wsBitMask);
__asm__ __volatile__ ("nop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop");
}

void SEND_WS_12_1() {
SET_PERI_REG_MASK(PERIPHS_GPIO_BASEADDR, wsBitMask);
__asm__ __volatile__ ("nop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop");
__asm__ __volatile__ ("nop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop");
CLEAR_PERI_REG_MASK(PERIPHS_GPIO_BASEADDR, wsBitMask);
}

void ICACHE_FLASH_ATTR WS2812OutBuffer(uint8_t * buffer, uint16_t length,uint16_t repetition)
{
uint16_t i;
ets_intr_lock();

for (i = 0; i < 2; i++)
WRITE_PERI_REG(PERIPHS_GPIO_BASEADDR + 8, wsBitMask);
while (repetition--)
{
for (i = 0; i < length; i++)
{
uint8_t mask = 0x80;
uint8_t byte = buffer[i];
while (mask)
{
(byte & mask) ? SEND_WS_12_1() : SEND_WS_12_0();
mask >>= 1;
}
}
}
ets_intr_unlock();
}



costaud wrote:
1. The new PWM module.
(a) It does not appear possible to achieve 100% pulse width (100% on). I cannot get past around 90% - I've tried frequencies of 1024 and 500 - makes no difference.
(b) There does not appear to be any function to turn off the PWM - which is a problem as once activated, things like controlling fast serial LEDs on another pin become impossible because of the constant interrupts affecting the timing. Can we please have a stop function so that the PWM can be turned on and off. As the source is not available for this we cannot change this ourselves.


About the PWM issue:
1.Dut to the Algorithm , we can provide up to 90 duty at period 1000us(1KHz)
2.Make sure you choosed 80Mhz SPI clock frequency when downloading the firmware.
3.The param freq has been replaced by period, which ranges from 1000us to 10000us.
4.Set the duty of each PWM channle to ZERO , so that the timer would stop and PWM stops.

Statistics: Posted by scargill — Wed Jun 24, 2015 3:31 pm


]]>
2015-06-24T02:46:40+08:00 2015-06-24T02:46:40+08:00 https://bbs.espressif.com:443/viewtopic.php?t=631&p=2378#p2378 <![CDATA[Re: PWM and SNTP issues]]>
FORGET the GPIO16 issue - nothing to do with the ESP-12s AT ALL.... my friendly PCB designer thoughtfully shorted GPIO16 to RESET to aid with SLEEP !!!

I'll just go away and crawl into a corner...

Statistics: Posted by scargill — Wed Jun 24, 2015 2:46 am


]]>
2015-06-24T02:18:09+08:00 2015-06-24T02:18:09+08:00 https://bbs.espressif.com:443/viewtopic.php?t=631&p=2377#p2377 <![CDATA[Re: PWM and SNTP issues]]>
???

costaud wrote:
1. The new PWM module.
(a) It does not appear possible to achieve 100% pulse width (100% on). I cannot get past around 90% - I've tried frequencies of 1024 and 500 - makes no difference.
(b) There does not appear to be any function to turn off the PWM - which is a problem as once activated, things like controlling fast serial LEDs on another pin become impossible because of the constant interrupts affecting the timing. Can we please have a stop function so that the PWM can be turned on and off. As the source is not available for this we cannot change this ourselves.


About the PWM issue:
1.Dut to the Algorithm , we can provide up to 90 duty at period 1000us(1KHz)
2.Make sure you choosed 80Mhz SPI clock frequency when downloading the firmware.
3.The param freq has been replaced by period, which ranges from 1000us to 10000us.
4.Set the duty of each PWM channle to ZERO , so that the timer would stop and PWM stops.

Statistics: Posted by scargill — Wed Jun 24, 2015 2:18 am


]]>
2015-06-23T20:01:06+08:00 2015-06-23T20:01:06+08:00 https://bbs.espressif.com:443/viewtopic.php?t=631&p=2372#p2372 <![CDATA[Re: PWM and SNTP issues]]>
1. Is there any chance this 90% will improve? Could be worth a bodge to set to 100% manually at full duty.
2. 80Mhz is default.
3. Understand.
4. No. Setting to 0,0,0 is definitely NOT the same has having never used the PWM. I have routines to run serial LEDs - they disable interrupts briefly when narrow pulses are sent out to the LEDs - then re-enable them - I can publish the code.... If I reboot the board - my serial LED works. I then turn that off and enable PWM..... when done with PWM I set the period to 0,0,0 and the serial LEDS will NOT start working properly after that. This is 100% repeatable - something has changed.

Here is the code used to handle serial LEDs - it works perfectly until PWM is introduced. I don't expect it to work while PWM is running but I WOULD expect it to work when PWM is set to 0,0,0.

void SEND_WS_12_0() {
SET_PERI_REG_MASK(PERIPHS_GPIO_BASEADDR, wsBitMask);
__asm__ __volatile__ ("nop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop");
CLEAR_PERI_REG_MASK(PERIPHS_GPIO_BASEADDR, wsBitMask);
__asm__ __volatile__ ("nop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop");
}

void SEND_WS_12_1() {
SET_PERI_REG_MASK(PERIPHS_GPIO_BASEADDR, wsBitMask);
__asm__ __volatile__ ("nop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop");
__asm__ __volatile__ ("nop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop""\n\tnop");
CLEAR_PERI_REG_MASK(PERIPHS_GPIO_BASEADDR, wsBitMask);
}

void ICACHE_FLASH_ATTR WS2812OutBuffer(uint8_t * buffer, uint16_t length,uint16_t repetition)
{
uint16_t i;
ets_intr_lock();

for (i = 0; i < 2; i++)
WRITE_PERI_REG(PERIPHS_GPIO_BASEADDR + 8, wsBitMask);
while (repetition--)
{
for (i = 0; i < length; i++)
{
uint8_t mask = 0x80;
uint8_t byte = buffer[i];
while (mask)
{
(byte & mask) ? SEND_WS_12_1() : SEND_WS_12_0();
mask >>= 1;
}
}
}
ets_intr_unlock();
}







costaud wrote:
1. The new PWM module.
(a) It does not appear possible to achieve 100% pulse width (100% on). I cannot get past around 90% - I've tried frequencies of 1024 and 500 - makes no difference.
(b) There does not appear to be any function to turn off the PWM - which is a problem as once activated, things like controlling fast serial LEDs on another pin become impossible because of the constant interrupts affecting the timing. Can we please have a stop function so that the PWM can be turned on and off. As the source is not available for this we cannot change this ourselves.


About the PWM issue:
1.Dut to the Algorithm , we can provide up to 90 duty at period 1000us(1KHz)
2.Make sure you choosed 80Mhz SPI clock frequency when downloading the firmware.
3.The param freq has been replaced by period, which ranges from 1000us to 10000us.
4.Set the duty of each PWM channle to ZERO , so that the timer would stop and PWM stops.

Statistics: Posted by scargill — Tue Jun 23, 2015 8:01 pm


]]>
2015-06-23T17:56:57+08:00 2015-06-23T17:56:57+08:00 https://bbs.espressif.com:443/viewtopic.php?t=631&p=2368#p2368 <![CDATA[Re: PWM and SNTP issues]]> Statistics: Posted by scargill — Tue Jun 23, 2015 5:56 pm


]]>
2015-06-23T16:19:53+08:00 2015-06-23T16:19:53+08:00 https://bbs.espressif.com:443/viewtopic.php?t=631&p=2364#p2364 <![CDATA[Re: PWM and SNTP issues]]>

1. The new PWM module.
(a) It does not appear possible to achieve 100% pulse width (100% on). I cannot get past around 90% - I've tried frequencies of 1024 and 500 - makes no difference.
(b) There does not appear to be any function to turn off the PWM - which is a problem as once activated, things like controlling fast serial LEDs on another pin become impossible because of the constant interrupts affecting the timing. Can we please have a stop function so that the PWM can be turned on and off. As the source is not available for this we cannot change this ourselves.


About the PWM issue:
1.Dut to the Algorithm , we can provide up to 90 duty at period 1000us(1KHz)
2.Make sure you choosed 80Mhz SPI clock frequency when downloading the firmware.
3.The param freq has been replaced by period, which ranges from 1000us to 10000us.
4.Set the duty of each PWM channle to ZERO , so that the timer would stop and PWM stops.

Statistics: Posted by costaud — Tue Jun 23, 2015 4:19 pm


]]>
2015-06-20T18:05:49+08:00 2015-06-20T18:05:49+08:00 https://bbs.espressif.com:443/viewtopic.php?t=631&p=2328#p2328 <![CDATA[Re: PWM and SNTP issues]]>

(b) Are there plans to add a function to ensure daylight savings (summer/winter time) are taken into account. This is important for an automated installation.


But here it must be considererd, that
1) this should be an option and it must be able to dis-/enabled.
2) changing between the summer and winter time country dependent. Not every country changes there time on the same day.

Best regards
Blackfarmer

Statistics: Posted by Blackfarmer — Sat Jun 20, 2015 6:05 pm


]]>
2015-06-20T14:16:13+08:00 2015-06-20T14:16:13+08:00 https://bbs.espressif.com:443/viewtopic.php?t=631&p=2324#p2324 <![CDATA[PWM and SNTP issues]]>
1. The new PWM module.
(a) It does not appear possible to achieve 100% pulse width (100% on). I cannot get past around 90% - I've tried frequencies of 1024 and 500 - makes no difference.
(b) There does not appear to be any function to turn off the PWM - which is a problem as once activated, things like controlling fast serial LEDs on another pin become impossible because of the constant interrupts affecting the timing. Can we please have a stop function so that the PWM can be turned on and off. As the source is not available for this we cannot change this ourselves.

2. The SNTP module.
(a) The simple example in the SDK manual works - on second reading, it picks up the time (first time it just shows a count of 0 and the date 1970). When I add the timezone offset however, it never gets the time and remains at 1970. Can we have a complete example including timezone setting.
(b) Are there plans to add a function to ensure daylight savings (summer/winter time) are taken into account. This is important for an automated installation.

Statistics: Posted by scargill — Sat Jun 20, 2015 2:16 pm


]]>