User avatar
By StefanB
#55304
scargill wrote:pwm/pwm.c: In function 'pwm_intr_handler':
pwm/pwm.c:117:3: error: 'asm' undeclared (first use in this function)
asm volatile ("" : : : "memory");
^


"asm" is an GCC extension, which is enabled by default when using GCC

Specifying e.g. "-std=c99" disables any GCC extensions. You have to use "-std=gnu99", "-std=gnu11" or similar, or just keep the default.
User avatar
By StefanB
#55306
scargill wrote:Setting to 99 it fades up to maybe half way, then goes off for a while (longer than the fade time), then comes fully on.
Setting to 0, it goes off for a while, briefly flashes at half brillliance then goes off again.


There was a bug in the COMPAT mode which limited the duty cycle to 20%. 20% duty is approximately 50% brighness.


scargill wrote:Also I've just realised that once I've initiated the PWM, some of my other stuff fails - like writing I2c to SEEED displays produces rubbish, other I2c operations fail. I've tried both interrrupt types - both show the same issues, both cause problems when supposedly not running (i.e. once used the continue to cause other issues). The Espressif code causes this issue (interfering with PWM - but that's because it is running all the time regardless - I was hoping to avoid this. So - right now I'm back to Espressif unless anyone has any ideas.


The ESP8266 lacks real I2C support, AFAIK. So it has to emulate the I2C clock and data lines using delays and toggling GPIOs at the right time. At 100kBit/s the clock line has to be toggled every 5us. So there are two possible conflicts:
    The pwm runs at the same time as the I2C transfer and destroys any timing
    The I2C delay code uses the same timer as the PWM