This is a major concern with using micro controllers for any kind of timing applications above 10 Khz. This has caused entire projects to be completely scrapped and redesigned.
I have seen this design problem on all Arduino and Maple Mini Boards and I am sure there are others !!!!!
Is this a board or manufacturing design flaw ?
Is this an MCU design flaw ?
Why have MCU micro controller design engineers not even addressed this issue ???
Have you had or seen this problem before ???
If any MCU design engineers can explain this issue, this is your chance.
Turning off interrupts could help this kind of periodic jitter. On the uno you could try detaching interrupts 0 and 1 and check for ttl waveform anomalies, or use a nointerrupts() section.
Hello Richard,
I did try nointerrupts() on the stm32 maple mini using the arduino programming interface a while back.
I also have tried high sped switching directly from the registry.
GPIOA->regs->BSRR = 0b0000000000000010;
delayMicroseconds(ontime);
GPIOA->regs->BSRR = 0b0000000000000010 << 16; //move to upper 16 bits
delayMicroseconds(offtime);
I will give that another try when I get some time.
Many thank Richard
This is a Signal Integrity (SI) problem. Review your circuitry at an analog level. Also it could be a layout problem with output traces feeding back into the input.
Hi Steven,
That is exactly what I originally thought (SI) issue.
The signal reading was taken directly from the pwm pin using a x10 high quality probe.
I was thinking possibly poor board design and trace layout, stray capacitance and inductance between traces.
I will look in to this issue in more detail later,
Use a ground spring connection on a quality x10 probe for direct signal contact.
Disable interrupts then test the pin8 signal and work way back to MCU IC pins direct.
Will give update ....
Also make sure you are triggering on the scope correctly. I would use above the worst case HI logic level voltage and set up for positive edge. Also make sure your scope is grounded properly- check to be sure ! Aliasing may be present from your scope, but not likely.
One other thing to think about is the compiled code you end up with. Specifically regarding things like disabling interrupts, compilers like the Arduino interface don't always (read 'never') end up with compiled code that is neat and tidy, i.e. with all the unused stuff tied down properly.
So I'd bottom out that you're actually running code that is doing exactly what you think it is. If you're using the Arduino tools, I guarantee you it won't be. There will likely also be janky interactions on things like the port controller and any DMAC hardware coming out of the hidden parts of the Arduino code that may cause activity on the interrupt controller.
From a signal integrity point of view, unless you're operating in the many tens of MHz, or have a PLL frequency well above 100Mhz, or overclocking the chip, you should be able to get the jitter down pretty low without doing anything particularly exotic. Just make sure traces are nice and short with no 90 degree bends atwixt the crystal and the osc pins.
Personally I'd say unless you've made a schoolboy error on the layout for the oscillator, then the problem is far more likely to be software related. Things like the Arduino tools are meant for hobbyists/students tinkering. They are most definitely not suitable for high end, timing critical applications. I cannot stress that point enough. You must explicitly switch off, or set to a known state, every single peripheral/output/interrupt or you will get issues. Even then, if you're using hobbyist tools, and regardless on some controllers, the order in which you do it can be important.
As a final point, I'd say make sure you've got your scope set up correctly. Although you may have identified it properly as jitter, you may be seeing (in the images above) artefact in the trigger when you capture the waveform. If you've got an infinite persistence feature on your scope, that's a better mode to use. (I'm a Techtronix guy, and don't know Rigol scopes well...)
Good luck.
I agree with David in that make sure how you are triggering on the scope in terms of thresholds, rise/fall times, delays, offsets, and coupling (AC, DC, ...etc).
If you are at 50% triggering voltage, its very possible that your 'jitter' is really in the scope, not on your PCB. ;-)
If you don't receive the email within an hour (and you've checked your Spam folder), email us as confirmation@grabcad.com