mirror of
https://github.com/gillham/logic_analyzer.git
synced 2026-05-06 05:45:28 +03:00
Compare commits
5 Commits
agla_v0_12
...
agla_leona
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d333f16ba | ||
|
|
c8e564f6f0 | ||
|
|
d0afee13d2 | ||
|
|
23fb253929 | ||
|
|
3128dc35f0 |
67
README
67
README
@@ -1,49 +1,28 @@
|
||||
SUMP compatible logic analyzer for Arduino
|
||||
==========================================
|
||||
|
||||
NOTE: With v0.11 you can now sample at 4MHz & 2MHz rates in addition to the
|
||||
previous 1MHz and lower rates. This is done via unrolled loops which
|
||||
makes the source code huge and the binary takes much more of the flash.
|
||||
v0.11 is just slightly to big for an ATmega168's flash. You can comment
|
||||
out either captureInline2mhz() or captureInline4mhz() and it will fit.
|
||||
|
||||
NOTE: v0.09 switched the channels BACK to pins 8-13 for trigger reliability.
|
||||
Please report any issues. Uncomment USE_PORTD for pins 2-7.
|
||||
|
||||
This Arduino sketch implements a SUMP protocol compatible with the standard
|
||||
SUMP client as well as the alternative client from here:
|
||||
http://www.lxtreme.nl/ols/
|
||||
|
||||
The alternative client version is highly recommended. Download version
|
||||
"ols-0.9.7" or newer for built-in device profiles.
|
||||
|
||||
This SUMP protocol compatible logic analyzer for the Arduino board supports
|
||||
5 channels consisting of digital pins 8-12, which are the first 5 bits (0-4)
|
||||
of PORTB. Arduino pin 13 / bit 5 is the Arduino LED, bits 6 & 7 are the
|
||||
crystal oscillator pins.
|
||||
|
||||
Uncomment CHAN5 below if you want to use the LED pin as an input and have
|
||||
6 channels.
|
||||
|
||||
On the Arduino Mega board 8 channels are supported and 7k of samples.
|
||||
Pins 22-29 (Port A) are used by default, you can change the 'CHANPIN' below
|
||||
if something else works better for you.
|
||||
|
||||
NOTE:
|
||||
If you are using the original SUMP client, or using the alternative client
|
||||
without the device profiles, then you will get a "device not found" error.
|
||||
You must DISABLE the Arduino auto reset feature to use this logic analyzer
|
||||
code. There are various methods to do this, some boards have a jumper,
|
||||
others require you to cut a trace. You may also install a *precisely*
|
||||
120 Ohm resistor between the reset & 5V piins. Make sure it is really
|
||||
120 Ohm or you may damage your board. It is much easier to use the
|
||||
alternative SUMP client referenced above.
|
||||
|
||||
The device profiles should be included with this code. Copy them to the
|
||||
'plugins' directory of the client. The location varies depending on the
|
||||
platform, but on the mac it is here by default:
|
||||
/Applications/LogicSniffer.app/Contents/Resources/Java/plugins
|
||||
Pins 22-29 (Port A) are used by default.
|
||||
|
||||
To use this with the original or alternative SUMP clients,
|
||||
use these settings:
|
||||
|
||||
Sampling rate: 4MHz (or lower)
|
||||
Sampling rate: 4MHz (or lower) (no 2MHz on ATmega168)
|
||||
Channel Groups: 0 (zero) only
|
||||
Recording Size:
|
||||
ATmega168: 532 (or lower)
|
||||
@@ -57,8 +36,38 @@ below 1MHz. 1MHz works for a basic busy wait trigger that doesn't store
|
||||
until after the trigger fires.
|
||||
Please try it out and report back.
|
||||
|
||||
This master branch now supports Arduino 1.0 only.
|
||||
Checkout branch logic_analyzer_v0_5 for Arduino 22 support.
|
||||
Older Notes
|
||||
===========================================================================
|
||||
NOTE: With v0.11 you can now sample at 4MHz & 2MHz rates in addition to the
|
||||
previous 1MHz and lower rates. This is done via unrolled loops which
|
||||
makes the source code huge and the binary takes much more of the flash.
|
||||
v0.11 is just slightly to big for an ATmega168's flash. You can comment
|
||||
out either captureInline2mhz() or captureInline4mhz() and it will fit.
|
||||
[ The code automatically skips the 2MHz code now, this isn't needed. ]
|
||||
|
||||
NOTE: v0.09 switched the channels BACK to pins 8-13 for trigger reliability.
|
||||
Please report any issues. Uncomment USE_PORTD for pins 2-7.
|
||||
|
||||
NOTE: The device profiles should be included with this code. Copy them to the
|
||||
'plugins' directory of the client. The location varies depending on the
|
||||
platform, but on the mac it is here by default:
|
||||
/Applications/LogicSniffer.app/Contents/Resources/Java/plugins
|
||||
[ These are included in ols-0.9.7 or newer so do not copy them. ]
|
||||
|
||||
NOTE: If you are using the original SUMP client, then you will get a
|
||||
"device not found" error.
|
||||
You must DISABLE the Arduino auto reset feature to use this logic analyzer
|
||||
code. There are various methods to do this, some boards have a jumper,
|
||||
others require you to cut a trace. You may also install a *precisely*
|
||||
120 Ohm resistor between the reset & 5V piins. Make sure it is really
|
||||
120 Ohm or you may damage your board. It is much easier to use the
|
||||
alternative SUMP client referenced above.
|
||||
[ This is not needed with ols-0.9.7 or newer. ]
|
||||
[ DO NOT use this resistor unless absolutely necessary on old clients. ]
|
||||
|
||||
NOTE: This master branch now supports Arduino 1.0 only.
|
||||
Checkout branch logic_analyzer_v0_5 for Arduino 22 support.
|
||||
|
||||
|
||||
Release: v0.12 September 6, 2013.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* SUMP Protocol Implementation for Arduino boards.
|
||||
*
|
||||
* Copyright (c) 2011,2012,2013 Andrew Gillham
|
||||
* Copyright (c) 2011,2012,2013,2014 Andrew Gillham
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -44,26 +44,10 @@
|
||||
* Pins 22-29 (Port A) are used by default, you can change the 'CHANPIN' below
|
||||
* if something else works better for you.
|
||||
*
|
||||
* NOTE:
|
||||
* If you are using the original SUMP client, or using the alternative client
|
||||
* without the device profiles, then you will get a "device not found" error.
|
||||
* You must DISABLE the Arduino auto reset feature to use this logic analyzer
|
||||
* code. There are various methods to do this, some boards have a jumper,
|
||||
* others require you to cut a trace. You may also install a *precisely*
|
||||
* 120 Ohm resistor between the reset & 5V piins. Make sure it is really
|
||||
* 120 Ohm or you may damage your board.
|
||||
* It is much easier to use the alternative SUMP client from here:
|
||||
* http://www.lxtreme.nl/ols/
|
||||
*
|
||||
* The device profiles should be included with this code. Copy them to the
|
||||
* 'plugins' directory of the client. The location varies depending on the
|
||||
* platform, but on the mac it is here by default:
|
||||
* /Applications/LogicSniffer.app/Contents/Resources/Java/plugins
|
||||
*
|
||||
* To use this with the original or alternative SUMP clients,
|
||||
* use these settings:
|
||||
*
|
||||
* Sampling rate: 4MHz (or lower)
|
||||
* Sampling rate: 4MHz (or lower) (no 2MHz on ATmega168)
|
||||
* Channel Groups: 0 (zero) only
|
||||
* Recording Size:
|
||||
* ATmega168: 532 (or lower)
|
||||
@@ -104,6 +88,11 @@ void debugdump(void);
|
||||
* PORTD support with triggers seems to work but needs more testing.
|
||||
*/
|
||||
//#define USE_PORTD 1
|
||||
#if defined(USE_PORTD)
|
||||
#define SHIFTBITS 2
|
||||
#elif defined(__AVR_ATmega32U4__)
|
||||
#define SHIFTBITS 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Arduino device profile: ols.profile-agla.cfg
|
||||
@@ -130,6 +119,15 @@ void debugdump(void);
|
||||
#define CHAN5 7
|
||||
#else
|
||||
#define CHANPIN PINB
|
||||
#if defined(__AVR_ATmega32U4__)
|
||||
#define CHAN0 SCK
|
||||
#define CHAN1 MOSI
|
||||
#define CHAN2 MISO
|
||||
#define CHAN3 8
|
||||
#define CHAN4 9
|
||||
#define CHAN5 10
|
||||
#define CHAN6 11
|
||||
#else
|
||||
#define CHAN0 8
|
||||
#define CHAN1 9
|
||||
#define CHAN2 10
|
||||
@@ -137,8 +135,9 @@ void debugdump(void);
|
||||
#define CHAN4 12
|
||||
/* Comment out CHAN5 if you don't want to use the LED pin for an input */
|
||||
#define CHAN5 13
|
||||
#endif /* AVR_ATmega32U4 */
|
||||
#endif /* USE_PORTD */
|
||||
#endif
|
||||
#endif /* Mega1280 or Mega2560 */
|
||||
#define ledPin 13
|
||||
|
||||
/* XON/XOFF are not supported. */
|
||||
@@ -170,6 +169,9 @@ void debugdump(void);
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
#define DEBUG_CAPTURE_SIZE 7168
|
||||
#define CAPTURE_SIZE 7168
|
||||
#elif defined(__AVR_ATmega32U4__)
|
||||
#define DEBUG_CAPTURE_SIZE 1536
|
||||
#define CAPTURE_SIZE 1536
|
||||
#elif defined(__AVR_ATmega328P__)
|
||||
#define DEBUG_CAPTURE_SIZE 1024
|
||||
#define CAPTURE_SIZE 1024
|
||||
@@ -221,6 +223,10 @@ boolean rleEnabled = 0;
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial) {
|
||||
; // wait for serial port to connect. Needed for Leonardo only
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* set debug pin (digital pin 8) to output right away so it settles.
|
||||
@@ -238,14 +244,15 @@ void setup()
|
||||
#ifdef CHAN5
|
||||
pinMode(CHAN5, INPUT);
|
||||
#endif
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
#ifdef CHAN6
|
||||
pinMode(CHAN6, INPUT);
|
||||
#endif
|
||||
#ifdef CHAN7
|
||||
pinMode(CHAN7, INPUT);
|
||||
#else
|
||||
#endif
|
||||
#ifndef CHAN5
|
||||
pinMode(ledPin, OUTPUT);
|
||||
#endif
|
||||
#endif /* Mega */
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -315,7 +322,9 @@ void loop()
|
||||
}
|
||||
else if (divider == 49) {
|
||||
/* 2.0MHz */
|
||||
#if defined(__AVR_ATmega168P__)
|
||||
captureInline2mhz();
|
||||
#endif
|
||||
}
|
||||
else if (useMicro) {
|
||||
if (trigger && (delayTime != 1)) {
|
||||
@@ -335,8 +344,8 @@ void loop()
|
||||
* we can just use it directly as our trigger mask.
|
||||
*/
|
||||
getCmd();
|
||||
#ifdef USE_PORTD
|
||||
trigger = cmdBytes[0] << 2;
|
||||
#ifdef SHIFTBITS
|
||||
trigger = cmdBytes[0] << SHIFTBITS;
|
||||
#else
|
||||
trigger = cmdBytes[0];
|
||||
#endif
|
||||
@@ -347,8 +356,8 @@ void loop()
|
||||
* defines whether we're looking for it to be high or low.
|
||||
*/
|
||||
getCmd();
|
||||
#ifdef USE_PORTD
|
||||
trigger_values = cmdBytes[0] << 2;
|
||||
#ifdef SHIFTBITS
|
||||
trigger_values = cmdBytes[0] << SHIFTBITS;
|
||||
#else
|
||||
trigger_values = cmdBytes[0];
|
||||
#endif
|
||||
@@ -581,8 +590,8 @@ void captureMicro() {
|
||||
* is done for any triggers, this is effectively the 0/100 buffer split.
|
||||
*/
|
||||
for (i = 0 ; i < readCount; i++) {
|
||||
#ifdef USE_PORTD
|
||||
Serial.write(logicdata[i] >> 2);
|
||||
#ifdef SHIFTBITS
|
||||
Serial.write(logicdata[i] >> SHIFTBITS);
|
||||
#else
|
||||
Serial.write(logicdata[i]);
|
||||
#endif
|
||||
@@ -656,8 +665,8 @@ void captureMilli() {
|
||||
}
|
||||
}
|
||||
for (i = 0 ; i < readCount; i++) {
|
||||
#ifdef USE_PORTD
|
||||
Serial.write(logicdata[i] >> 2);
|
||||
#ifdef SHIFTBITS
|
||||
Serial.write(logicdata[i] >> SHIFTBITS);
|
||||
#else
|
||||
Serial.write(logicdata[i]);
|
||||
#endif
|
||||
@@ -850,8 +859,8 @@ void triggerMicro() {
|
||||
if (logicIndex >= readCount) {
|
||||
logicIndex = 0;
|
||||
}
|
||||
#ifdef USE_PORTD
|
||||
Serial.write(logicdata[logicIndex++] >> 2);
|
||||
#ifdef SHIFTBITS
|
||||
Serial.write(logicdata[logicIndex++] >> SHIFTBITS);
|
||||
#else
|
||||
Serial.write(logicdata[logicIndex++]);
|
||||
#endif
|
||||
@@ -897,6 +906,8 @@ void get_metadata() {
|
||||
Serial.write('A');
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
Serial.write('M');
|
||||
#elif defined(__AVR_ATmega32U4__)
|
||||
Serial.write('L');
|
||||
#endif /* Mega */
|
||||
Serial.write('v');
|
||||
Serial.write('0');
|
||||
@@ -918,6 +929,10 @@ void get_metadata() {
|
||||
/* 7168 bytes */
|
||||
Serial.write((uint8_t)0x1C);
|
||||
Serial.write((uint8_t)0x00);
|
||||
#elif defined(__AVR_ATmega32U4__)
|
||||
/* 1024 bytes */
|
||||
Serial.write((uint8_t)0x04);
|
||||
Serial.write((uint8_t)0x00);
|
||||
#elif defined(__AVR_ATmega328P__)
|
||||
/* 1024 bytes */
|
||||
Serial.write((uint8_t)0x04);
|
||||
@@ -937,15 +952,15 @@ void get_metadata() {
|
||||
|
||||
/* number of probes (6 by default on Arduino, 8 on Mega) */
|
||||
Serial.write((uint8_t)0x40);
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
#ifdef CHAN7
|
||||
Serial.write((uint8_t)0x08);
|
||||
#else
|
||||
#ifdef CHAN5
|
||||
#elif CHAN6
|
||||
Serial.write((uint8_t)0x07);
|
||||
#elif CHAN5
|
||||
Serial.write((uint8_t)0x06);
|
||||
#else
|
||||
Serial.write((uint8_t)0x05);
|
||||
#endif /* CHAN5 */
|
||||
#endif /* Mega */
|
||||
#endif
|
||||
|
||||
/* protocol version (2) */
|
||||
Serial.write((uint8_t)0x41);
|
||||
@@ -1008,8 +1023,8 @@ void debugdump() {
|
||||
Serial.print("\r\n");
|
||||
|
||||
for (i = 0 ; i < MAX_CAPTURE_SIZE; i++) {
|
||||
#ifdef USE_PORTD
|
||||
Serial.print(logicdata[i] >> 2, HEX);
|
||||
#ifdef SHIFTBITS
|
||||
Serial.print(logicdata[i] >> SHIFTBITS, HEX);
|
||||
#else
|
||||
Serial.print(logicdata[i], HEX);
|
||||
#endif
|
||||
@@ -1033,3 +1048,5 @@ void debugdump() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* SUMP Protocol Implementation for Arduino boards.
|
||||
*
|
||||
* Copyright (c) 2011,2012,2013 Andrew Gillham
|
||||
* Copyright (c) 2011,2012,2013,2014 Andrew Gillham
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* SUMP Protocol Implementation for Arduino boards.
|
||||
*
|
||||
* Copyright (c) 2011,2012,2013 Andrew Gillham
|
||||
* Copyright (c) 2011,2012,2013,2014 Andrew Gillham
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
Reference in New Issue
Block a user