Pages: [1]   Go Down
Author Topic: Logic analyser  (Read 893 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I've been trying to use Arduino to build a logic scope to debug an 8-bit computer I built. I need at least 8 channels and capture logic signals at 1MHz. I've tried most of the Arduino-based logic scope/oscilloscope sketches and none of them seem to work. So I decided to write a sketch from the scratch (rhyme!). It seems obvious to use a digitalRead function and pass on the readings to the Serial.println. On the recipient side I use Max MSP to visualise the incoming data. Yet I'm not entirely sure if it works. Do I need to set the ADC resolution from 8-bit to a higher value? What is the recommended Baud-rate? Any ideas or experience?
Logged

Chicago
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you need to capture pin state on the 8 channels? I have a logic analyzer but never use it to show glitch. Ive only use to to record pin state and debug the 68hc11 and 8048 8051 series mpu.

Logged

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need to see what's happening on the data/address lines. I do need to see the logic state of at least 8 pins.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25884
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It seems obvious to use a digitalRead function and pass on the readings to the Serial.println.
It isn't obvious at all.
The digitalRead function on a 16MHz Arduino will never get close to 1MHz, and neither will printing the results via a Serial print.
Use port manipulation (i.e. make sure all the analyser pins are on same port) and read them to a memory buffer, not a serial print.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I wonder if the Due can deal with 1MHz logic signals?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25884
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

With it's larger memory, I'd say it would be ideal.
Make sure you use level convertors though (could be simple voltage dividers), unless you're operating at the same supply voltages.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hm, that's the thing, my singleboard operates at 5 volts which could fry the Due in no time. What you recommended seems viable, it's not that hard to build voltage dividers (and maybe use resistor arrays to save space). How about using the analog inputs on a Mega? Would the Mega work?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25884
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How about using the analog inputs on a Mega?
And divide your capture rate by many hundreds?
No, I don't think that would be a good idea.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The best you can do is to use direct port manipulation (read 6 lines at once) but even then I expect not more than somewhere around 10K signals max.
- http://www.arduino.cc/en/Reference/PortManipulation -

Would look like this (not tested, but to get you started)
Code:
void setup()
{
  Serial.begin(115200);
  DDRB = 0xFF;
}

void loop()
{
  Serial.print((char)PINB);
}



Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 126
Posts: 8475
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe you should have a look at this

http://arduino.cc/forum/index.php/topic,52881.0.html

Or buy a Saleae logic, it will be the best $149 you'll ever spend.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Or buy a Saleae logic, it will be the best $149 you'll ever spend.
+1
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Considering buying it! Thanks!
Logged

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How about this board:

http://www.digilentinc.com/Products/Catalog.cfm?NavPath=2,892&Cat=18

It's 32 bits, 80MHz clock, 512K Flash and 32K SRAM. Besides the digital pins can endure 5V unlike the Due.
Logged

Pages: [1]   Go Up
Jump to: