Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 11 months ago.
Glitching on p7 and p8?
Dear everyone, I seem to be in a bit of a pickle with an mBED LPC1768. I can't seem to get p7 and p8 to behave themselves. After a lot of debugging I ended up with the following:
- The mBED is connected to nothing but a USB cable and oscilloscope digital probes.
- The debug code is a build-up from the well-known `blinky' file (see below).
Code used:
Modified blinky to show issues with p7 and p8.
#include "mbed.h" DigitalOut myled(LED1); DigitalOut SYNC(p7); DigitalOut potCLK(p8); DigitalOut DIN(p9); int main() { potCLK = 0; SYNC = 0; DIN=0; while(1) { myled = 1; wait(0.2); myled = 0; wait(0.2); } }
As you can see I am attempting to pull both p7 and p8 low. The following trace is what I obtain from my oscilloscope:
Disturbingly we observe that:
- p7 (channel 0) refuses to drop.
- p8 (channel 1) glitches upwards for some unfathomable reason.
- The few moments during which p7 assumes its desired value and p8 glitches are correlated, as I'm triggering on the falling edge of p8.
Other information that may or may not constitute important clues can be seen in the image still (notably the timescale of 100ns/div). Also, please ignore digital channel 2 and analogue channel 1 as they are completely irrelevant to this subject.
If anyone has any ideas as to why this might be happening and more importantly, how to fix it I would greatly appreciate it. Thanks.
3 Answers
10 years, 11 months ago.
Try using Analog scope on MBED pins, also a little additional decoupling will go a long way,
?? what voltage is your Digital scope set to, because it looks like you have -250mV trigger,
so i am guessing it is potentially set to 1 volt (or less) logic level,
where as it should be 3V3 !!
that would explain a lot of your problems..
Ceri
10 years, 11 months ago.
Analog probes might already give you more information. Main thing I wonder, is your ground properly connected? Because this would be consistent with a lack of ground connection.
10 years, 11 months ago.
Oh dear... You are right. Removing the mBED from its host PCB did sever the GND connection. This answers the glitching issue on p8, but p7 is still misbehaving.
This is what happens when I try to force it low with the following piece of code (i.e. pressing `h' at the right time):
while (c != 'e'){ c=pc.getc(); //User input prompt. . . . if(c == 'j'){ SYNC=1; printf("Potentiometer locked.\n \r"); } if(c == 'h'){ SYNC=0; printf("Potentiometer writable.\n \r"); } }
It seems to bounce back within about 40ns and I should perhaps mention that:
- The dots represent just comments, so the while loop runs `as is'.
- I am not using any self-repeating routines such as Timeout or the like.
Thanks.