Go Down

Topic: arduino text to o-scope decode (Read 423 times) previous topic - next topic

cyberwasp

I'd like to test my new scopes decode feature. Can someone point me to  a sketch that would let the Arduino send serial text to my SDS1204X-E. I saw a demo on youtube awhile ago but lost it. TIA

fishboneDiagram

I'm going to take a wild stab, but it says here:

Quote
Serial bus decoding for IIC, SPI, UART, CAN, LIN bus types is included
... so wouldn't you just do a Serial.print("here's some text") and hook the probes to the serial port, with the 'scope in "UART mode"?




cyberwasp

That's what I was going to try tomorrow am. But being a beginner with Arduino sketches and oscilloscopes I was looking for a bit of guidance. Only accomplishment I've had so far was a sine wave from the arduino.

fishboneDiagram

Well I don't know how to set the 'scope to whatever mode, but this will send some text:

Code: [Select]
void setup()
{
  Serial.begin(9600);
  Serial.println("Hello, World");
}

void loop()
{
}



Grumpy_Mike

#4
Feb 07, 2020, 10:57 am Last Edit: Feb 07, 2020, 11:03 am by Grumpy_Mike
But as you want to see it decoded on an oscilloscope this would be better:-
Code: [Select]
void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println("Hello, my Oscilloscope");
  delay(60);
}

Because it sends serial data over and over and not just once. The delay gives a gap making it easy to trigger the scope to a stable pattern.

Connect the scope to pin 1 of the Arduino and the scope earth the the Arduino ground.

If you want to see a stable short signal that you can read in one screen change the message to "AB", you should see the numbers 65 and 66 sent repeatedly.

cyberwasp

Thanks Mike and fishbone. I was using serial.Write instead println.

Grumpy_Mike

Quote
I was using serial.Write instead println.
It is ok to do that, you will get the actual numbers if you do. So if you send 45 you will see 45.

It is a lot simpler if you write hex numbers because it is very easy to convert from a trace into a hex number.

cyberwasp

Sorry guys. I guess you can't teach an old dog new tricks. I got the sketch to output to the IDE monitor.

When setting up the scope I followed the video, "Learn Oscilloscope Basics with an Arduino Uno and RTM3004 | AddOhms #28.

When I go to the scope I  set up the decode and tell it to display the ASCII, 7bits and to trigger on the H only to end up with the letter k and a bunch of % symbols.

 At least the sketch is right, just need to find the correct settings on the scope.


Code: [Select]
void setup()
{
  Serial.begin(9600);
 
}

void loop()
{
 Serial.println("Hello");

 delay(500);
 }

groundFungus

#8
Feb 07, 2020, 11:39 pm Last Edit: Feb 07, 2020, 11:40 pm by groundFungus
Arduino serial UART default is  8 bits, no parity, 1 start bit.

cyberwasp

Well, I was getting close to it working when the dang plug fell out of the scope, I wish they get rid of those cheap plugs. Had a computer monitor like that and finally hard wired it.

I was following the manual for the scope in setting up the UART decode when it happened. Will try again tomorrow after I cool off.


cyberwasp

Ok, I tried it again made some progress. instead of decoding the word, "hello," from the sketch I end up with random characters as shown in the attached photo.

The scope is set to ASCII 8/n/1, Serial, UART channel 1 is hooked to ground and TX on arduino

Still trying thing but thought I'd update to all who are helping me!


alesstr

Hi,

as i was going just over the same thing (well not just to test but to debug my serial.....).
I have a SDS 1104X-E which is the same scope just a bit faster with 4ch-s.
Banging my head over the same thing why serial monitor gives good data but decode on scope just random chars.
So i tried to go over the menus in my scope and found THE MENU :)

the last picture you have sent you need to click the right most button under NEXT PAGE and you will get 2 options, one is Idle level which is by default set to LOW - but TX is by default HIGH......change this one and the other one leave on LSB and it should work.....at least it did for me :)

BR
Ales

MarkT

Yes, it can only decode if you set it to the same settings as the serial signal, baud, start, stop, parity, polarity, endianness.
Arduino uses 8 data bits, no parity, 1 stop bit, idle high, and LSB first, which are pretty much the only
values you see these days with TTL level serial.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

DrAzzy

I have the 2-channel version of that scope. I love it, only thing I wish it had was 2 more channels! Hey, lemme show you something really cool - just look away for a second, I'll show you how I did it, I just want to see your surprise, it's so awesome... (30 seconds later) *slamming door* "Dude, where's my scope?!"

As an aside, I don't find decoding UART on a 'scope to be worth the effort, generally - it's usually easier to just take a USB serial adapter (ie, a sub-$3 CH340G or CP210x from ebay), connect ground and RX to the serial line, and fire up a serial terminal program with the appropriate settings and read it out that way.

For Windows, I like hTerm, personally - not only does it have all the bells and whistles you could ever want (I particularly like how you can choose to display as ASCII, hex, decimal, and/or binary - including more than one at a time - or specify what you send in the same way (great for sending control codes, or for devices where the data isn't all printing characters)), but it also displays the state of the modem control lines (there are 4 of them, active low, with internal pullup; most of them aren't broken out on most adapters), and manually toggle DTR and RTS. The latter means that autoreset is manually controlled (assuming using typical DTR reset circuit) rather than happening always and only when you open port, while the former lets you see on the screen the state of 4 pins - Sure, it's not a 'scope, and you don't get a graph of it or anything, but sometimes just seeing it on the screen right next to the serial output is mighty helpful. hTerm is also free, tiny, and doesn't need to be "installed" - it's just an executable that you run.

Decoding on the 'scope is much more useful for SPI - and even moreso for I2C, since you can make it trigger on a start condition aimed at a specific address. That was very helpful for debugging a particular issue with a software I2C implementation a couple years ago.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

cyberwasp

Thanks guys. I finally got it working. Was not doing it for work but just to see it in action and using it as a teaching tool to better understand the oscilloscope.

Go Up