12 Commits

Author SHA1 Message Date
Andrew Gillham
a426e85f0d Bump the metadata version to 0.15 also. 2021-12-21 12:01:55 -06:00
Andrew Gillham
b919640c7e Add a note about needing to compile the OLS client yourself. 2021-12-21 11:43:55 -06:00
Andrew Gillham
636df223a4 Bump release to 0.15 now that we have re-organized. 2021-12-21 11:36:21 -06:00
Andrew Gillham
57b1f18900 Move the main ATMega328P sketch into a sub-directory and add the Leonardo sketch to a sub-directory from the branch. Helps folks that download the repository via ZIP file and will allow different board support that is not easily done via ifdef checks. 2021-12-21 11:27:31 -06:00
Andrew Gillham
4f7f86f6d4 Convert Makefile to use arduino-cli since that replaces arduino-core and arduino-builder. 2021-12-21 11:11:38 -06:00
gillham
bd1fbe504e Merge pull request #51 from qaxi/master
Wrong delayTime in 500KHz menu
2021-12-20 15:14:22 -06:00
Petr Klíma
cfacce1758 500KMz
500KHz line was mistakenly 1MHz
2019-12-15 19:08:39 +01:00
gillham
11b8b5bbda Merge pull request #27 from dhiltonp/master
Give Leonardo-type Arduinos 2k sample size.
2016-02-02 10:03:21 -08:00
David P Hilton
4233770315 Give Leonardo-type arduinos 2048 storage 2016-02-02 11:14:06 -05:00
Andrew Gillham
1e3f0696af Update for CLI compiling.
Add function declarations for the inline capture functions and add a
note to the README explaining how to compile from the CLI using the
‘arduino-mk’ package.   Known to work on Debian 8, but untested
elsewhere.
2015-12-16 11:47:31 -08:00
Andrew Gillham
5fb67c666d v0.14. Rearrange DEBUG functionality, disable by default.
v0.14. Add ‘DEBUG_MENU’ which can be uncommented to enable the basic
debug menu with the ability to run a capture / dump the data etc.
DEBUG and DEBUG_MENU are commented out by default to save RAM.
2015-12-16 11:15:10 -08:00
Andrew Gillham
9a065516e2 Add additional diagnostic commands.
You can connect via the serial monitor and send ‘?’ to get a list of
commands available.  This allows some diagnostics when the board isn’t
working with the OLS client.
Sending ‘4’ does a 4MHz capture and ‘2’ dumbs the data buffer for
example.  Recommended to use this with the simulated signal via a
timer.  See the bottom of the setup() function and change the ‘#if 0’
to ‘#if 1’ to enable it.
Also, fix a long standing bug that broke 2MHz captures and the
ATmega168. (improper #if defined check)
2015-02-07 12:17:24 -08:00
9 changed files with 30176 additions and 63 deletions

View File

@@ -1,19 +1,24 @@
# #
# Makefile for an Arduino based logic analyzer using the 'arduino-core' # Makefile for an Arduino based logic analyzer using the arduino-cli
# package and makefiles.
# #
# $Id: Makefile,v 1.3 2011-03-07 02:47:26 gillham Exp $
#
ARDUINO_DIR = /usr/share/arduino
TARGET = logic_analyzer TARGET = logic_analyzer
ARDUINO_LIBS = FQBN = arduino:avr:diecimila
SERIAL = /dev/ttyUSB*
MCU = atmega328p
F_CPU = 16000000
ARDUINO_PORT = /dev/ttyUSB*
AVRDUDE_ARD_BAUDRATE = 57600
AVRDUDE_ARD_PROGRAMMER = arduino
include /usr/share/arduino/Arduino.mk all:
@echo ""
@echo "---> run 'make build' to compile for Arduino Duemilanove"
@echo "---> run 'make upload' to upload to /dev/ttyUSB*"
@echo ""
build:
arduino-cli compile --fqbn $(FQBN) $(TARGET)
upload:
arduino-cli upload --fqbn $(FQBN) --port $(SERIAL) $(TARGET)
#
# end-of-file
#

34
README
View File

@@ -7,6 +7,9 @@ SUMP client as well as the alternative client from here:
The alternative client version is highly recommended. Download version The alternative client version is highly recommended. Download version
"ols-0.9.7" or newer for built-in device profiles. "ols-0.9.7" or newer for built-in device profiles.
NOTE: The latest officially released version of ols (0.9.7.2) does not work
with modern Java runtimes. You will need to build it yourself.
Follow the build instructions here: https://github.com/jawi/ols
This SUMP protocol compatible logic analyzer for the Arduino board supports 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) 5 channels consisting of digital pins 8-12, which are the first 5 bits (0-4)
@@ -36,6 +39,35 @@ below 1MHz. 1MHz works for a basic busy wait trigger that doesn't store
until after the trigger fires. until after the trigger fires.
Please try it out and report back. Please try it out and report back.
Debugging
=========
You can uncomment the '#define DEBUG_MENU' line to add some diagnostic menu
options for capturing or dumping the capture buffer.
You can uncomment the '#define DEBUG' and '#define DEBUG_MENU' for a couple
extra menu options and logging of the received commands. The DEBUG option
is generally only useful for development, while the DEBUG_MENU option is
good for troubleshooting when the logic_analyzer sketch isn't working for you.
Both are disabled by default to conserve RAM for improved stability.
CLI compiling
=============
If you want to use the 'arduino-mk' package (on Debian for example ) to compile
this using the Makefile, you'll need to make a couple of changes since the
Makefile only supports a single .ino file. Basically you just need to append
the other two files to the main .ino and then remove them.
$ cat logic_analyzer_inline_4mhz.ino >> logic_analyzer.ino
$ cat logic_analyzer_inline_2mhz.ino >> logic_analyzer.ino
$ rm logic_analyzer_inline_4mhz.ino logic_analyzer_inline_2mhz.ino
$ make
This will make GIT unhappy so if you need to revert it to run 'git pull' do
this:
$ git reset --hard origin/master
Older Notes Older Notes
=========================================================================== ===========================================================================
NOTE: With v0.11 you can now sample at 4MHz & 2MHz rates in addition to the NOTE: With v0.11 you can now sample at 4MHz & 2MHz rates in addition to the
@@ -69,5 +101,5 @@ NOTE: This master branch now supports Arduino 1.0 only.
Checkout branch logic_analyzer_v0_5 for Arduino 22 support. Checkout branch logic_analyzer_v0_5 for Arduino 22 support.
Release: v0.12 September 6, 2013. Release: v0.15 December 21, 2021.

View File

@@ -2,7 +2,7 @@
* *
* SUMP Protocol Implementation for Arduino boards. * SUMP Protocol Implementation for Arduino boards.
* *
* Copyright (c) 2011,2012,2013,2014 Andrew Gillham * Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021 Andrew Gillham
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@
* until after the trigger fires. * until after the trigger fires.
* Please try it out and report back. * Please try it out and report back.
* *
* Release: v0.12 September 6, 2013. * Release: v0.15 December 21, 2021.
* *
*/ */
@@ -81,7 +81,9 @@ void blinkled(void);
void get_metadata(void); void get_metadata(void);
void debugprint(void); void debugprint(void);
void debugdump(void); void debugdump(void);
void prettydump(void);
void captureInline4mhz(void);
void captureInline2mhz(void);
/* /*
* Should we use PORTD or PORTB? (default is PORTB) * Should we use PORTD or PORTB? (default is PORTB)
@@ -154,6 +156,9 @@ void debugdump(void);
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define DEBUG_CAPTURE_SIZE 7168 #define DEBUG_CAPTURE_SIZE 7168
#define CAPTURE_SIZE 7168 #define CAPTURE_SIZE 7168
#elif defined(__AVR_ATmega32U4__)
#define DEBUG_CAPTURE_SIZE 2048
#define CAPTURE_SIZE 2048
#elif defined(__AVR_ATmega328P__) #elif defined(__AVR_ATmega328P__)
#define DEBUG_CAPTURE_SIZE 1024 #define DEBUG_CAPTURE_SIZE 1024
#define CAPTURE_SIZE 1024 #define CAPTURE_SIZE 1024
@@ -170,8 +175,11 @@ void debugdump(void);
#define DEBUG_ENABLE DDRD = DDRD | B10000000 #define DEBUG_ENABLE DDRD = DDRD | B10000000
#define DEBUG_ON PORTD = B10000000 #define DEBUG_ON PORTD = B10000000
#define DEBUG_OFF PORTD = B00000000 #define DEBUG_OFF PORTD = B00000000
#endif #endif /* USE_PORTD */
#define DEBUG
//#define DEBUG_MENU
//#define DEBUG
#ifdef DEBUG #ifdef DEBUG
#define MAX_CAPTURE_SIZE DEBUG_CAPTURE_SIZE #define MAX_CAPTURE_SIZE DEBUG_CAPTURE_SIZE
#else #else
@@ -263,7 +271,7 @@ void loop()
if (Serial.available() > 0) { if (Serial.available() > 0) {
cmdByte = Serial.read(); cmdByte = Serial.read();
switch(cmdByte) { switch (cmdByte) {
case SUMP_RESET: case SUMP_RESET:
/* /*
* We don't do anything here as some unsupported extended commands have * We don't do anything here as some unsupported extended commands have
@@ -299,7 +307,7 @@ void loop()
} }
else if (divider == 49) { else if (divider == 49) {
/* 2.0MHz */ /* 2.0MHz */
#if defined(__AVR_ATmega168P__) #if !defined(__AVR_ATmega168__)
captureInline2mhz(); captureInline2mhz();
#endif #endif
} }
@@ -390,17 +398,30 @@ void loop()
case SUMP_SELF_TEST: case SUMP_SELF_TEST:
/* ignored. */ /* ignored. */
break; break;
#ifdef DEBUG #ifdef DEBUG_MENU
/* /*
* a couple of debug commands used during development. * a couple of debug commands used during development.
*/ */
case '?':
Serial.println("");
#ifdef DEBUG
Serial.println("0 = clear cmd buffer");
Serial.println("1 = print cmd buffer");
#endif /* DEBUG */
Serial.println("2 = print data buffer");
Serial.println("3 = pretty print buffer");
Serial.println("4 = capture at 4MHz");
Serial.println("5 = capture at 1MHz");
Serial.println("6 = capture at 500KHz");
break;
#ifdef DEBUG
case '0': case '0':
/* /*
* This resets the debug buffer pointer, effectively clearing the * This resets the debug buffer pointer, effectively clearing the
* previous commands out of the buffer. Clear the sample data as well. * previous commands out of the buffer. Clear the sample data as well.
* Just send a '0' from the Arduino IDE's Serial Monitor. * Just send a '0' from the Arduino IDE's Serial Monitor.
*/ */
savecount=0; savecount = 0;
for (i = 0 ; i < MAX_CAPTURE_SIZE; i++) { for (i = 0 ; i < MAX_CAPTURE_SIZE; i++) {
logicdata[i] = 0; logicdata[i] = 0;
} }
@@ -414,13 +435,48 @@ void loop()
blinkled(); blinkled();
debugprint(); debugprint();
break; break;
#endif /* DEBUG */
case '2': case '2':
/* /*
* This dumps the sample data to the serial port. Used for debugging. * This dumps the sample data to the serial port.
*/ */
debugdump(); debugdump();
break; break;
#endif /* DEBUG */ case '3':
/*
* Prints a visual representation of the data buffer.
*/
prettydump();
break;
case '4':
/*
* This runs a sample capture at 4MHz.
*/
captureInline4mhz();
Serial.println("");
Serial.println("4MHz capture done.");
break;
case '5':
/*
* This runs a sample capture at 1MHz.
* delayTime = 1ms for 1MHz sampling.
*/
delayTime = 1;
captureMicro();
Serial.println("");
Serial.println("1MHz capture done.");
break;
case '6':
/*
* This runs a sample capture at 500KHz.
* delayTime = 2ms for 500KHz.
*/
delayTime = 2;
captureMicro();
Serial.println("");
Serial.println("500KHz capture done.");
break;
#endif /* DEBUG_MENU */
default: default:
/* ignore any unrecognized bytes. */ /* ignore any unrecognized bytes. */
break; break;
@@ -595,7 +651,7 @@ void captureMicro() {
void captureMilli() { void captureMilli() {
unsigned int i = 0; unsigned int i = 0;
if(rleEnabled) { if (rleEnabled) {
/* /*
* very basic trigger, just like in captureMicros() above. * very basic trigger, just like in captureMicros() above.
*/ */
@@ -606,16 +662,16 @@ void captureMilli() {
byte lastSample = 0; byte lastSample = 0;
byte sampleCount = 0; byte sampleCount = 0;
while(i < readCount) { while (i < readCount) {
/* /*
* Implementation of the RLE unlimited protocol: timings might be off a little * Implementation of the RLE unlimited protocol: timings might be off a little
*/ */
if(lastSample == (CHANPIN & B01111111) && sampleCount < 127) { if (lastSample == (CHANPIN & B01111111) && sampleCount < 127) {
sampleCount++; sampleCount++;
delay(delayTime); delay(delayTime);
continue; continue;
} }
if(sampleCount != 0) { if (sampleCount != 0) {
logicdata[i] = B10000000 | sampleCount; logicdata[i] = B10000000 | sampleCount;
sampleCount = 0; sampleCount = 0;
i++; i++;
@@ -893,7 +949,7 @@ void get_metadata() {
Serial.write('0'); Serial.write('0');
Serial.write('.'); Serial.write('.');
Serial.write('1'); Serial.write('1');
Serial.write('2'); Serial.write('5');
Serial.write((uint8_t)0x00); Serial.write((uint8_t)0x00);
/* sample memory */ /* sample memory */
@@ -942,7 +998,7 @@ void get_metadata() {
} }
/* /*
* This is used by the '0' debug command to dump the contents of some * This is used by the '1' debug command to dump the contents of some
* interesting variables and the debug buffer. * interesting variables and the debug buffer.
* *
*/ */
@@ -983,6 +1039,8 @@ void debugprint() {
Serial.println("done..."); Serial.println("done...");
} }
#endif /* DEBUG */
#ifdef DEBUG_MENU
/* /*
* This is used by the '2' debug command to dump the contents * This is used by the '2' debug command to dump the contents
* of the sample buffer. * of the sample buffer.
@@ -1007,7 +1065,37 @@ void debugdump() {
j++; j++;
} }
} }
#endif /* DEBUG */
/*
* This is used by the '3' debugs command to dump the first 64 bytes
* of the sample buffer.
* It prints the data in a graphical representation.
*/
void prettydump() {
int i;
byte j;
byte k;
Serial.print("\r\n");
for (i = 0 ; i < 64; i++) {
#ifdef USE_PORTD
k = logicdata[i] >> 2;
#else
k = logicdata[i];
#endif
for (j = 0; j < 8; j++) {
if (k & 0x01)
Serial.print("| ");
else
Serial.print(" |");
k = k >> 1;
}
Serial.print("\r\n");
}
}
#endif /* DEBUG_MENU */

View File

@@ -2,7 +2,7 @@
* *
* SUMP Protocol Implementation for Arduino boards. * SUMP Protocol Implementation for Arduino boards.
* *
* Copyright (c) 2011,2012,2013 Andrew Gillham * Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021 Andrew Gillham
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -2,7 +2,7 @@
* *
* SUMP Protocol Implementation for Arduino boards. * SUMP Protocol Implementation for Arduino boards.
* *
* Copyright (c) 2011,2012,2013 Andrew Gillham * Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021 Andrew Gillham
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -0,0 +1,24 @@
#
# Makefile for an Arduino based logic analyzer using the arduino-cli
#
TARGET = logic_analyzer_leonardo
FQBN = arduino:avr:leonardo
SERIAL = /dev/ttyUSB*
all:
@echo ""
@echo "---> run 'make build' to compile for Arduino Leonardo"
@echo "---> run 'make upload' to upload to /dev/ttyUSB*"
@echo ""
build:
arduino-cli compile --fqbn $(FQBN) $(TARGET)
upload:
arduino-cli upload --fqbn $(FQBN) --port $(SERIAL) $(TARGET)
#
# end-of-file
#

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff