stm32f1 DMA to PWM first bit issue
Hi,
Im new to stm forums so sorry if i make any mistakes.
Im using a stm32f103RET6 since i am familiar with f103 and i need usb/other peripherals. Thus far everything works great. However...
Im trying to offload some work from cpu to DMA by sending a premade array to the timer, it works fine for the most part except if the very first bit of the transfer (the first DMA byte) is a 1, due to an issue the pin after going high as expected in the same period it goes low and high again when it it not asked, thus confusing the ic's interpreting it as 2x 0bits.
If that is unclear i attached a screenshot showing the dip. Some things i made sure of/tested already:
- It is not a hardware issue, i designed the pcb myself and the trace to the first led is very short and away from any other digital line
- I disabled all other code/generated a minimum POC and the problem persists
- The period/baud is set and never modified by the code
- I do not change the array or cancel the DMA in my code
- It is reproduceable and i verified/reuploaded the code many times
- The array i analyzed with stlink and is correct
- The cpu is running at a steady 72Mhz on an external oscillator and the timer works fine in other modes
- Most of the code is generated by CubeMX, i only added the array, rgb logic and HAL_TIM_PWM_Start_DMA()
- I am using Platformio with Cube framework, but i doubt that is the issue since that has always worked fine, i am also unfamiliar with other ide's.
What im trying to do:
im trying to control neopixels, basically a 1.25µs (800khz baud) signal with >60%high = 1 and <40% high = 0. The pixels work perfectly on all 3 channels until the first bit goes high (green channel >=128) when the first bit errors and the ic's treat it as 2x0 causing all the next bits to shift. If i bit-bang the pixels everything is correct, but i would like to try and use the dma, since i have other things to spend cpu cycles on ;)
Has anyone come across this issue, is there some way to fix this?
PS: im trying to upload the code but for some reason its not working, ill try to do it in the comments, or if you ask me a specific bit i can post it.
