mirror of
https://github.com/gillham/logic_analyzer.git
synced 2026-05-07 00:01:09 +03:00
Compare commits
30 Commits
agla_v0_3
...
aglan_alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b9c3e7314 | ||
|
|
17d2a1a15f | ||
|
|
0a40fdb2ac | ||
|
|
1f7eb0aecd | ||
|
|
dc3d85abf7 | ||
|
|
240ebc134c | ||
|
|
396a3ccfa5 | ||
|
|
864ae2c826 | ||
|
|
445dac179c | ||
|
|
0f81002bde | ||
|
|
fb3aca55a0 | ||
|
|
851b7e0735 | ||
|
|
b1a43e57c7 | ||
|
|
1f418098b2 | ||
|
|
34aea7435d | ||
|
|
f51d0bbb96 | ||
|
|
3a6329775c | ||
|
|
3c69ec10a1 | ||
|
|
7173e83e14 | ||
|
|
5ec7aa1b51 | ||
|
|
ebbc1fb945 | ||
|
|
bc32e9fde6 | ||
|
|
6396054c16 | ||
|
|
d8cd29d86a | ||
|
|
cedcd4b685 | ||
|
|
6ebd1c5b06 | ||
|
|
9f688ff112 | ||
|
|
035873cc81 | ||
|
|
6a05cd22ea | ||
|
|
c923ff1a0c |
27
README
27
README
@@ -1,6 +1,9 @@
|
|||||||
SUMP compatible logic analyzer for Arduino
|
SUMP compatible logic analyzer for Arduino
|
||||||
==========================================
|
==========================================
|
||||||
|
|
||||||
|
NOTE: NOTE: v0.09 switches 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
|
This Arduino sketch implements a SUMP protocol compatible with the standard
|
||||||
SUMP client as well as the alternative client from here:
|
SUMP client as well as the alternative client from here:
|
||||||
http://www.lxtreme.nl/ols/
|
http://www.lxtreme.nl/ols/
|
||||||
@@ -12,19 +15,34 @@ crystal oscillator pins.
|
|||||||
Uncomment CHAN5 below if you want to use the LED pin as an input and have
|
Uncomment CHAN5 below if you want to use the LED pin as an input and have
|
||||||
6 channels.
|
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:
|
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
|
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,
|
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*
|
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 resistor between the reset & 5V piins. Make sure it is really
|
||||||
120 Ohm or you may damage your board.
|
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
|
||||||
|
|
||||||
To use this with the original or alternative SUMP clients,
|
To use this with the original or alternative SUMP clients,
|
||||||
use these settings:
|
use these settings:
|
||||||
|
|
||||||
Sampling rate: 1MHz (or lower)
|
Sampling rate: 1MHz (or lower)
|
||||||
Channel Groups: 0 (zero) only
|
Channel Groups: 0 (zero) only
|
||||||
Recording Size: 1024 (or lower)
|
Recording Size:
|
||||||
|
ATmega168: 532 (or lower)
|
||||||
|
ATmega328: 1024 (or lower)
|
||||||
|
ATmega2560: 7168 (or lower)
|
||||||
Noise Filter: doesn't matter
|
Noise Filter: doesn't matter
|
||||||
RLE: disabled (unchecked)
|
RLE: disabled (unchecked)
|
||||||
|
|
||||||
@@ -33,5 +51,8 @@ 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.
|
||||||
|
|
||||||
Release: v0.03 March 7, 2011.
|
This master branch now supports Arduino 1.0 only.
|
||||||
|
Checkout branch logic_analyzer_v0_5 for Arduino 22 support.
|
||||||
|
|
||||||
|
Release: v0.09 June 22, 2013.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* SUMP Protocol Implementation for Arduino boards.
|
* SUMP Protocol Implementation for Arduino boards.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 Andrew Gillham
|
* Copyright (c) 2011,2012,2013 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
|
||||||
@@ -25,43 +25,75 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: logic_analyzer.pde,v 1.14 2011-03-08 07:14:42 gillham Exp $
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* NOTE: This is an ALPHA of support for an Ethernet attached Logic Analyzer.
|
||||||
|
* Tested with an Arduino Duemilanove and W5100 based Ethernet shield.
|
||||||
|
* It may work with other combinations, but I haven't tested it.
|
||||||
|
*
|
||||||
|
* USE: Configure the mac address (if you want) and the ip address (mandatory)
|
||||||
|
* for your network and upload it. In the OLS client select network
|
||||||
|
* instead of serial and use your ip address and port 1234.
|
||||||
|
* Click capture! You should get some data back from your Arduino.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: v0.09 switches 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/
|
||||||
|
*
|
||||||
* 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)
|
* 6 channels consisting of digital pins 2-7, which are the last 6 bits (2-7)
|
||||||
* of PORTB. Arduino pin 13 / bit 5 is the Arduino LED, bits 6 & 7 are the
|
* of PORTD. Bits 0 & 1 are the UART RX/TX pins.
|
||||||
* crystal oscillator pins.
|
*
|
||||||
* Uncomment CHAN5 below if you want to use the LED pin as an input and have
|
* On the Arduino Mega board 8 channels are supported and 7k of samples.
|
||||||
* 6 channels.
|
* Pins 22-29 (Port A) are used by default, you can change the 'CHANPIN' below
|
||||||
|
* if something else works better for you.
|
||||||
*
|
*
|
||||||
* NOTE:
|
* 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
|
* 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,
|
* 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*
|
* 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 resistor between the reset & 5V piins. Make sure it is really
|
||||||
* 120 Ohm or you may damage your board.
|
* 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,
|
* To use this with the original or alternative SUMP clients,
|
||||||
* use these settings:
|
* use these settings:
|
||||||
*
|
*
|
||||||
* Sampling rate: 1MHz (or lower)
|
* Sampling rate: 1MHz (or lower)
|
||||||
* Channel Groups: 0 (zero) only
|
* Channel Groups: 0 (zero) only
|
||||||
* Recording Size: 1024 (or lower)
|
* Recording Size:
|
||||||
|
* ATmega168: 532 (or lower)
|
||||||
|
* ATmega328: 1024 (or lower)
|
||||||
|
* ATmega2560: 7168 (or lower)
|
||||||
* Noise Filter: doesn't matter
|
* Noise Filter: doesn't matter
|
||||||
* RLE: disabled (unchecked)
|
* RLE: disabled (unchecked)
|
||||||
|
* NOTE: Preliminary RLE support for 50Hz or less exists, please test it.
|
||||||
*
|
*
|
||||||
* Triggering is still a work in progress, but generally works for samples
|
* Triggering is still a work in progress, but generally works for samples
|
||||||
* below 1MHz. 1MHz works for a basic busy wait trigger that doesn't store
|
* 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.
|
||||||
*
|
*
|
||||||
* Release: v0.02 February 28, 2011.
|
* Release: v0.09 June 22, 2013.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <Ethernet.h>
|
||||||
/*
|
/*
|
||||||
* Function prototypes so this can compile from the cli.
|
* Function prototypes so this can compile from the cli.
|
||||||
* You'll need the 'arduino-core' package and to check the paths in the
|
* You'll need the 'arduino-core' package and to check the paths in the
|
||||||
@@ -79,15 +111,45 @@ void debugprint(void);
|
|||||||
void debugdump(void);
|
void debugdump(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Uncomment CHAN5 to use it as an additional input.
|
* Should we use PORTD or PORTB? (default is PORTB)
|
||||||
* You'll need to change the number of channels in the device profile as well.
|
* PORTD support with triggers seems to work but needs more testing.
|
||||||
*/
|
*/
|
||||||
|
#define USE_PORTD 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Arduino device profile: ols.profile-agla.cfg
|
||||||
|
* Arduino Mega device profile: ols.profile-aglam.cfg
|
||||||
|
*/
|
||||||
|
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
|
#define CHANPIN PINA
|
||||||
|
#define CHAN0 22
|
||||||
|
#define CHAN1 23
|
||||||
|
#define CHAN2 24
|
||||||
|
#define CHAN3 25
|
||||||
|
#define CHAN4 26
|
||||||
|
#define CHAN5 27
|
||||||
|
#define CHAN6 28
|
||||||
|
#define CHAN7 29
|
||||||
|
#else
|
||||||
|
#if defined(USE_PORTD)
|
||||||
|
#define CHANPIN PIND
|
||||||
|
#define CHAN0 2
|
||||||
|
#define CHAN1 3
|
||||||
|
#define CHAN2 4
|
||||||
|
#define CHAN3 5
|
||||||
|
#define CHAN4 6
|
||||||
|
#define CHAN5 7
|
||||||
|
#else
|
||||||
|
#define CHANPIN PINB
|
||||||
#define CHAN0 8
|
#define CHAN0 8
|
||||||
#define CHAN1 9
|
#define CHAN1 9
|
||||||
#define CHAN2 10
|
#define CHAN2 10
|
||||||
#define CHAN3 11
|
#define CHAN3 11
|
||||||
#define CHAN4 12
|
#define CHAN4 12
|
||||||
//#define CHAN5 13
|
/* Comment out CHAN5 if you don't want to use the LED pin for an input */
|
||||||
|
#define CHAN5 13
|
||||||
|
#endif /* USE_PORTD */
|
||||||
|
#endif
|
||||||
#define ledPin 13
|
#define ledPin 13
|
||||||
|
|
||||||
/* XON/XOFF are not supported. */
|
/* XON/XOFF are not supported. */
|
||||||
@@ -102,24 +164,45 @@ void debugdump(void);
|
|||||||
#define SUMP_TRIGGER_VALUES 0xC1
|
#define SUMP_TRIGGER_VALUES 0xC1
|
||||||
#define SUMP_TRIGGER_CONFIG 0xC2
|
#define SUMP_TRIGGER_CONFIG 0xC2
|
||||||
|
|
||||||
/* flags are ignored. */
|
/* Most flags (except RLE) are ignored. */
|
||||||
#define SUMP_SET_DIVIDER 0x80
|
#define SUMP_SET_DIVIDER 0x80
|
||||||
#define SUMP_SET_READ_DELAY_COUNT 0x81
|
#define SUMP_SET_READ_DELAY_COUNT 0x81
|
||||||
#define SUMP_SET_FLAGS 0x82
|
#define SUMP_SET_FLAGS 0x82
|
||||||
|
#define SUMP_SET_RLE 0x0100
|
||||||
|
|
||||||
/* extended commands -- self-test unsupported, but metadata is returned. */
|
/* extended commands -- self-test unsupported, but metadata is returned. */
|
||||||
#define SUMP_SELF_TEST 0x03
|
#define SUMP_SELF_TEST 0x03
|
||||||
#define SUMP_GET_METADATA 0x04
|
#define SUMP_GET_METADATA 0x04
|
||||||
|
|
||||||
/*
|
/* ATmega168: 532 (or lower)
|
||||||
* Capture size of 1024 bytes works on the ATmega328.
|
* ATmega328: 1024 (or lower)
|
||||||
*
|
* ATmega2560: 7168 (or lower)
|
||||||
*/
|
*/
|
||||||
|
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
|
#define DEBUG_CAPTURE_SIZE 7168
|
||||||
|
#define CAPTURE_SIZE 7168
|
||||||
|
#elif defined(__AVR_ATmega328P__)
|
||||||
|
#define DEBUG_CAPTURE_SIZE 1024
|
||||||
|
#define CAPTURE_SIZE 1024
|
||||||
|
#else
|
||||||
|
#define DEBUG_CAPTURE_SIZE 532
|
||||||
|
#define CAPTURE_SIZE 532
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_PORTD
|
||||||
|
#define DEBUG_ENABLE DDRB = DDRB | B00000001
|
||||||
|
#define DEBUG_ON PORTB = B00000001
|
||||||
|
#define DEBUG_OFF PORTB = B00000000
|
||||||
|
#else
|
||||||
|
#define DEBUG_ENABLE DDRD = DDRD | B10000000
|
||||||
|
#define DEBUG_ON PORTD = B10000000
|
||||||
|
#define DEBUG_OFF PORTD = B00000000
|
||||||
|
#endif
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define MAX_CAPTURE_SIZE 1024
|
#define MAX_CAPTURE_SIZE DEBUG_CAPTURE_SIZE
|
||||||
#else
|
#else
|
||||||
#define MAX_CAPTURE_SIZE 1024
|
#define MAX_CAPTURE_SIZE CAPTURE_SIZE
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -144,37 +227,77 @@ unsigned int trigger_values = 0;
|
|||||||
unsigned int useMicro = 0;
|
unsigned int useMicro = 0;
|
||||||
unsigned int delayTime = 0;
|
unsigned int delayTime = 0;
|
||||||
unsigned long divider = 0;
|
unsigned long divider = 0;
|
||||||
|
boolean rleEnabled = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enter a MAC address and IP address for your Arduino.
|
||||||
|
*/
|
||||||
|
byte mac[] = {
|
||||||
|
0x40, 0x00, 0x01, 0x02, 0x03, 0x04 };
|
||||||
|
IPAddress ip(192,168,1,200);
|
||||||
|
|
||||||
|
// Initialize the Ethernet server library
|
||||||
|
// with the IP address and port you want to use
|
||||||
|
// (port 80 is default for HTTP):
|
||||||
|
EthernetServer server(1234);
|
||||||
|
EthernetClient client;
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
// start the Ethernet connection and the server:
|
||||||
|
Ethernet.begin(mac, ip);
|
||||||
|
server.begin();
|
||||||
|
Serial.print("server is at ");
|
||||||
|
Serial.println(Ethernet.localIP());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set debug pin to output right away so it settles.
|
* set debug pin (digital pin 8) to output right away so it settles.
|
||||||
* this gets toggled during sampling as a way to measure
|
* this gets toggled during sampling as a way to measure
|
||||||
* the sample time. this is used during development to
|
* the sample time. this is used during development to
|
||||||
* properly pad out the sampling routines.
|
* properly pad out the sampling routines.
|
||||||
*/
|
*/
|
||||||
DDRD = DDRD | B10000000; /* debug measurement pin */
|
DEBUG_ENABLE; /* debug measurement pin */
|
||||||
|
|
||||||
pinMode(CHAN0, INPUT);
|
pinMode(CHAN0, INPUT);
|
||||||
|
digitalWrite(CHAN0, LOW);
|
||||||
pinMode(CHAN1, INPUT);
|
pinMode(CHAN1, INPUT);
|
||||||
|
digitalWrite(CHAN1, LOW);
|
||||||
pinMode(CHAN2, INPUT);
|
pinMode(CHAN2, INPUT);
|
||||||
|
digitalWrite(CHAN2, LOW);
|
||||||
pinMode(CHAN3, INPUT);
|
pinMode(CHAN3, INPUT);
|
||||||
|
digitalWrite(CHAN3, LOW);
|
||||||
pinMode(CHAN4, INPUT);
|
pinMode(CHAN4, INPUT);
|
||||||
|
digitalWrite(CHAN4, LOW);
|
||||||
#ifdef CHAN5
|
#ifdef CHAN5
|
||||||
pinMode(CHAN5, INPUT);
|
pinMode(CHAN5, INPUT);
|
||||||
|
digitalWrite(CHAN5, LOW);
|
||||||
|
#endif
|
||||||
|
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
|
pinMode(CHAN6, INPUT);
|
||||||
|
digitalWrite(CHAN6, LOW);
|
||||||
|
pinMode(CHAN7, INPUT);
|
||||||
|
digitalWrite(CHAN7, LOW);
|
||||||
#else
|
#else
|
||||||
|
#ifndef CHAN5
|
||||||
pinMode(ledPin, OUTPUT);
|
pinMode(ledPin, OUTPUT);
|
||||||
#endif /* CHAN5 */
|
#endif
|
||||||
|
#endif /* Mega */
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (Serial.available() > 0) {
|
// listen for incoming clients
|
||||||
cmdByte = Serial.read();
|
client = server.available();
|
||||||
|
if (client) {
|
||||||
|
Serial.println("new client");
|
||||||
|
while (client.connected()) {
|
||||||
|
if (client.available()) {
|
||||||
|
cmdByte = client.read();
|
||||||
switch(cmdByte) {
|
switch(cmdByte) {
|
||||||
case SUMP_RESET:
|
case SUMP_RESET:
|
||||||
/*
|
/*
|
||||||
@@ -185,10 +308,10 @@ void loop()
|
|||||||
break;
|
break;
|
||||||
case SUMP_QUERY:
|
case SUMP_QUERY:
|
||||||
/* return the expected bytes. */
|
/* return the expected bytes. */
|
||||||
Serial.print('1', BYTE);
|
client.write('1');
|
||||||
Serial.print('A', BYTE);
|
client.write('A');
|
||||||
Serial.print('L', BYTE);
|
client.write('L');
|
||||||
Serial.print('S', BYTE);
|
client.write('S');
|
||||||
break;
|
break;
|
||||||
case SUMP_ARM:
|
case SUMP_ARM:
|
||||||
/*
|
/*
|
||||||
@@ -222,7 +345,11 @@ void loop()
|
|||||||
* we can just use it directly as our trigger mask.
|
* we can just use it directly as our trigger mask.
|
||||||
*/
|
*/
|
||||||
getCmd();
|
getCmd();
|
||||||
|
#ifdef USE_PORTD
|
||||||
|
trigger = cmdBytes[0] << 2;
|
||||||
|
#else
|
||||||
trigger = cmdBytes[0];
|
trigger = cmdBytes[0];
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case SUMP_TRIGGER_VALUES:
|
case SUMP_TRIGGER_VALUES:
|
||||||
/*
|
/*
|
||||||
@@ -230,7 +357,11 @@ void loop()
|
|||||||
* defines whether we're looking for it to be high or low.
|
* defines whether we're looking for it to be high or low.
|
||||||
*/
|
*/
|
||||||
getCmd();
|
getCmd();
|
||||||
|
#ifdef USE_PORTD
|
||||||
|
trigger_values = cmdBytes[0] << 2;
|
||||||
|
#else
|
||||||
trigger_values = cmdBytes[0];
|
trigger_values = cmdBytes[0];
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case SUMP_TRIGGER_CONFIG:
|
case SUMP_TRIGGER_CONFIG:
|
||||||
/* read the rest of the command bytes, but ignore them. */
|
/* read the rest of the command bytes, but ignore them. */
|
||||||
@@ -269,8 +400,9 @@ void loop()
|
|||||||
delayCount = MAX_CAPTURE_SIZE;
|
delayCount = MAX_CAPTURE_SIZE;
|
||||||
break;
|
break;
|
||||||
case SUMP_SET_FLAGS:
|
case SUMP_SET_FLAGS:
|
||||||
/* read the rest of the command bytes, but ignore them. */
|
/* read the rest of the command bytes and check if RLE is enabled. */
|
||||||
getCmd();
|
getCmd();
|
||||||
|
rleEnabled = ((cmdBytes[1] & B1000000) != 0);
|
||||||
break;
|
break;
|
||||||
case SUMP_GET_METADATA:
|
case SUMP_GET_METADATA:
|
||||||
/*
|
/*
|
||||||
@@ -303,9 +435,7 @@ void loop()
|
|||||||
* you can use the Arduino serial monitor and send a '1' and get
|
* you can use the Arduino serial monitor and send a '1' and get
|
||||||
* a debug printout. useless except for development.
|
* a debug printout. useless except for development.
|
||||||
*/
|
*/
|
||||||
#ifndef CHAN5
|
|
||||||
blinkled();
|
blinkled();
|
||||||
#endif /* !CHAN5 */
|
|
||||||
debugprint();
|
debugprint();
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
@@ -318,18 +448,21 @@ void loop()
|
|||||||
default:
|
default:
|
||||||
/* ignore any unrecognized bytes. */
|
/* ignore any unrecognized bytes. */
|
||||||
break;
|
break;
|
||||||
}
|
} /* switch */
|
||||||
}
|
} /* if client.available() */
|
||||||
|
} /* while */
|
||||||
|
delay(1);
|
||||||
|
client.stop();
|
||||||
|
Serial.println("client disconnected?");
|
||||||
|
} /* if client */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CHAN5
|
|
||||||
void blinkled() {
|
void blinkled() {
|
||||||
digitalWrite(ledPin, HIGH);
|
digitalWrite(ledPin, HIGH);
|
||||||
delay(200);
|
delay(200);
|
||||||
digitalWrite(ledPin, LOW);
|
digitalWrite(ledPin, LOW);
|
||||||
delay(200);
|
delay(200);
|
||||||
}
|
}
|
||||||
#endif /* !CHAN5 */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extended SUMP commands are 5 bytes. A command byte followed by 4 bytes
|
* Extended SUMP commands are 5 bytes. A command byte followed by 4 bytes
|
||||||
@@ -340,10 +473,10 @@ void blinkled() {
|
|||||||
*/
|
*/
|
||||||
void getCmd() {
|
void getCmd() {
|
||||||
delay(10);
|
delay(10);
|
||||||
cmdBytes[0] = Serial.read();
|
cmdBytes[0] = client.read();
|
||||||
cmdBytes[1] = Serial.read();
|
cmdBytes[1] = client.read();
|
||||||
cmdBytes[2] = Serial.read();
|
cmdBytes[2] = client.read();
|
||||||
cmdBytes[3] = Serial.read();
|
cmdBytes[3] = client.read();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (savecount < 120 ) {
|
if (savecount < 120 ) {
|
||||||
@@ -376,11 +509,11 @@ void captureMicro() {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* basic trigger, wait until all trigger conditions are met on port B.
|
* basic trigger, wait until all trigger conditions are met on port.
|
||||||
* this needs further testing, but basic tests work as expected.
|
* this needs further testing, but basic tests work as expected.
|
||||||
*/
|
*/
|
||||||
if (trigger) {
|
if (trigger) {
|
||||||
while ((trigger_values ^ PINB) & trigger);
|
while ((trigger_values ^ CHANPIN) & trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -395,16 +528,16 @@ void captureMicro() {
|
|||||||
* this is used during development to measure the sample intervals.
|
* this is used during development to measure the sample intervals.
|
||||||
* it is best to just leave the toggling in place so we don't alter
|
* it is best to just leave the toggling in place so we don't alter
|
||||||
* any timing unexpectedly.
|
* any timing unexpectedly.
|
||||||
* Arduino pin 7 is being used here.
|
* Arduino digital pin 8 is being used here.
|
||||||
*/
|
*/
|
||||||
DDRD = DDRD | B10000000;
|
DEBUG_ENABLE;
|
||||||
PORTD = B10000000;
|
DEBUG_ON;
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
PORTD = B00000000;
|
DEBUG_OFF;
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
PORTD = B10000000;
|
DEBUG_ON;
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
PORTD = B00000000;
|
DEBUG_OFF;
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
|
|
||||||
if (delayTime == 1) {
|
if (delayTime == 1) {
|
||||||
@@ -412,22 +545,22 @@ void captureMicro() {
|
|||||||
* 1MHz sample rate = 1 uS delay so we can't use delayMicroseconds
|
* 1MHz sample rate = 1 uS delay so we can't use delayMicroseconds
|
||||||
* since our loop takes some time. The delay is padded out by hand.
|
* since our loop takes some time. The delay is padded out by hand.
|
||||||
*/
|
*/
|
||||||
PORTD = B10000000; /* debug timing measurement */
|
DEBUG_ON; /* debug timing measurement */
|
||||||
for (i = 0 ; i < readCount; i++) {
|
for (i = 0 ; i < readCount; i++) {
|
||||||
logicdata[i] = PINB;
|
logicdata[i] = CHANPIN;
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
}
|
}
|
||||||
PORTD = B00000000; /* debug timing measurement */
|
DEBUG_OFF; /* debug timing measurement */
|
||||||
}
|
}
|
||||||
else if (delayTime == 2) {
|
else if (delayTime == 2) {
|
||||||
/*
|
/*
|
||||||
* 500KHz sample rate = 2 uS delay, still pretty fast so we pad this
|
* 500KHz sample rate = 2 uS delay, still pretty fast so we pad this
|
||||||
* one by hand too.
|
* one by hand too.
|
||||||
*/
|
*/
|
||||||
PORTD = B10000000; /* debug timing measurement */
|
DEBUG_ON; /* debug timing measurement */
|
||||||
for (i = 0 ; i < readCount; i++) {
|
for (i = 0 ; i < readCount; i++) {
|
||||||
logicdata[i] = PINB;
|
logicdata[i] = CHANPIN;
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
@@ -435,7 +568,7 @@ void captureMicro() {
|
|||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
}
|
}
|
||||||
PORTD = B00000000; /* debug timing measurement */
|
DEBUG_OFF; /* debug timing measurement */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/*
|
/*
|
||||||
@@ -444,13 +577,13 @@ void captureMicro() {
|
|||||||
* a better logic analyzer)
|
* a better logic analyzer)
|
||||||
* start of real measurement
|
* start of real measurement
|
||||||
*/
|
*/
|
||||||
PORTD = B10000000; /* debug timing measurement */
|
DEBUG_ON; /* debug timing measurement */
|
||||||
for (i = 0 ; i < readCount; i++) {
|
for (i = 0 ; i < readCount; i++) {
|
||||||
logicdata[i] = PINB;
|
logicdata[i] = CHANPIN;
|
||||||
delayMicroseconds(delayTime - 1);
|
delayMicroseconds(delayTime - 1);
|
||||||
__asm__("nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t");
|
||||||
}
|
}
|
||||||
PORTD = B00000000; /* debug timing measurement */
|
DEBUG_OFF; /* debug timing measurement */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* re-enable interrupts now that we're done sampling. */
|
/* re-enable interrupts now that we're done sampling. */
|
||||||
@@ -461,7 +594,11 @@ void captureMicro() {
|
|||||||
* is done for any triggers, this is effectively the 0/100 buffer split.
|
* is done for any triggers, this is effectively the 0/100 buffer split.
|
||||||
*/
|
*/
|
||||||
for (i = 0 ; i < readCount; i++) {
|
for (i = 0 ; i < readCount; i++) {
|
||||||
Serial.print(logicdata[i], BYTE);
|
#ifdef USE_PORTD
|
||||||
|
client.write(logicdata[i] >> 2);
|
||||||
|
#else
|
||||||
|
client.write(logicdata[i]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,21 +620,60 @@ void captureMicro() {
|
|||||||
* this basic functionality.
|
* this basic functionality.
|
||||||
*/
|
*/
|
||||||
void captureMilli() {
|
void captureMilli() {
|
||||||
int i;
|
int i = 0;
|
||||||
|
|
||||||
|
if(rleEnabled) {
|
||||||
/*
|
/*
|
||||||
* very basic trigger, just like in captureMicros() above.
|
* very basic trigger, just like in captureMicros() above.
|
||||||
*/
|
*/
|
||||||
if (trigger) {
|
if (trigger) {
|
||||||
while ((trigger_values ^ PINB) & trigger);
|
while ((trigger_values ^ (CHANPIN & B01111111)) & trigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte lastSample = 0;
|
||||||
|
byte sampleCount = 0;
|
||||||
|
|
||||||
|
while(i < readCount) {
|
||||||
|
/*
|
||||||
|
* Implementation of the RLE unlimited protocol: timings might be off a little
|
||||||
|
*/
|
||||||
|
if(lastSample == (CHANPIN & B01111111) && sampleCount < 127) {
|
||||||
|
sampleCount++;
|
||||||
|
delay(delayTime);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(sampleCount != 0) {
|
||||||
|
logicdata[i] = B10000000 | sampleCount;
|
||||||
|
sampleCount = 0;
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
logicdata[i] = (CHANPIN & B01111111);
|
||||||
|
lastSample = (CHANPIN & B01111111);
|
||||||
|
delay(delayTime);
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/*
|
||||||
|
* very basic trigger, just like in captureMicros() above.
|
||||||
|
*/
|
||||||
|
if (trigger) {
|
||||||
|
while ((trigger_values ^ CHANPIN) & trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0 ; i < readCount; i++) {
|
for (i = 0 ; i < readCount; i++) {
|
||||||
logicdata[i] = PINB;
|
logicdata[i] = CHANPIN;
|
||||||
delay(delayTime);
|
delay(delayTime);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (i = 0 ; i < readCount; i++) {
|
for (i = 0 ; i < readCount; i++) {
|
||||||
Serial.print(logicdata[i], BYTE);
|
#ifdef USE_PORTD
|
||||||
|
client.write(logicdata[i] >> 2);
|
||||||
|
#else
|
||||||
|
client.write(logicdata[i]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,16 +703,16 @@ void triggerMicro() {
|
|||||||
* this is used during development to measure the sample intervals.
|
* this is used during development to measure the sample intervals.
|
||||||
* it is best to just leave the toggling in place so we don't alter
|
* it is best to just leave the toggling in place so we don't alter
|
||||||
* any timing unexpectedly.
|
* any timing unexpectedly.
|
||||||
* Arduino pin 7 is being used here.
|
* Arduino digital pin 8 is being used here.
|
||||||
*/
|
*/
|
||||||
DDRD = DDRD | B10000000;
|
DEBUG_ENABLE;
|
||||||
PORTD = B10000000;
|
DEBUG_ON;
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
PORTD = B00000000;
|
DEBUG_OFF;
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
PORTD = B10000000;
|
DEBUG_ON;
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
PORTD = B00000000;
|
DEBUG_OFF;
|
||||||
delayMicroseconds(20);
|
delayMicroseconds(20);
|
||||||
|
|
||||||
if (delayTime == 1) {
|
if (delayTime == 1) {
|
||||||
@@ -557,13 +733,13 @@ void triggerMicro() {
|
|||||||
/*
|
/*
|
||||||
* 500KHz case. We should be able to manage this in time.
|
* 500KHz case. We should be able to manage this in time.
|
||||||
*
|
*
|
||||||
* busy loop reading PINB until we trigger.
|
* busy loop reading CHANPIN until we trigger.
|
||||||
* we always start capturing at the start of the buffer
|
* we always start capturing at the start of the buffer
|
||||||
* and use it as a circular buffer
|
* and use it as a circular buffer
|
||||||
*/
|
*/
|
||||||
PORTD = B10000000; /* debug timing measurement */
|
DEBUG_ON; /* debug timing measurement */
|
||||||
while ((trigger_values ^ (logicdata[logicIndex] = PINB)) & trigger) {
|
while ((trigger_values ^ (logicdata[logicIndex] = CHANPIN)) & trigger) {
|
||||||
/* PORTD = B00000000; */
|
/* DEBUG_OFF; */
|
||||||
/* increment index. */
|
/* increment index. */
|
||||||
logicIndex++;
|
logicIndex++;
|
||||||
if (logicIndex >= readCount) {
|
if (logicIndex >= readCount) {
|
||||||
@@ -575,11 +751,11 @@ void triggerMicro() {
|
|||||||
* __asm__("nop\n\t""nop\n\t""nop\n\t");
|
* __asm__("nop\n\t""nop\n\t""nop\n\t");
|
||||||
*/
|
*/
|
||||||
__asm__("nop\n\t");
|
__asm__("nop\n\t");
|
||||||
/* PORTD = B10000000; */
|
/* DEBUG_ON; */
|
||||||
}
|
}
|
||||||
/* this pads the immediate trigger case to 2.0 uS, just as an example. */
|
/* this pads the immediate trigger case to 2.0 uS, just as an example. */
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
PORTD = B00000000; /* debug timing measurement */
|
DEBUG_OFF; /* debug timing measurement */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* One sample size delay. ends up being 2 uS combined with assignment
|
* One sample size delay. ends up being 2 uS combined with assignment
|
||||||
@@ -594,7 +770,7 @@ void triggerMicro() {
|
|||||||
triggerIndex = logicIndex;
|
triggerIndex = logicIndex;
|
||||||
|
|
||||||
/* keep sampling for delayCount after trigger */
|
/* keep sampling for delayCount after trigger */
|
||||||
PORTD = B10000000; /* debug timing measurement */
|
DEBUG_ON; /* debug timing measurement */
|
||||||
/*
|
/*
|
||||||
* this is currently taking:
|
* this is currently taking:
|
||||||
* 1025.5 uS for 512 samples. (512 samples, 0/100 split)
|
* 1025.5 uS for 512 samples. (512 samples, 0/100 split)
|
||||||
@@ -604,12 +780,12 @@ void triggerMicro() {
|
|||||||
if (logicIndex >= readCount) {
|
if (logicIndex >= readCount) {
|
||||||
logicIndex = 0;
|
logicIndex = 0;
|
||||||
}
|
}
|
||||||
logicdata[logicIndex++] = PINB;
|
logicdata[logicIndex++] = CHANPIN;
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
}
|
}
|
||||||
PORTD = B00000000; /* debug timing measurement */
|
DEBUG_OFF; /* debug timing measurement */
|
||||||
delayMicroseconds(100);
|
delayMicroseconds(100);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -617,22 +793,28 @@ void triggerMicro() {
|
|||||||
* Less than 500KHz case. This uses delayMicroseconds() and some padding
|
* Less than 500KHz case. This uses delayMicroseconds() and some padding
|
||||||
* to get precise timing, at least for the after trigger samples.
|
* to get precise timing, at least for the after trigger samples.
|
||||||
*
|
*
|
||||||
* busy loop reading PINB until we trigger.
|
* busy loop reading CHANPIN until we trigger.
|
||||||
* we always start capturing at the start of the buffer
|
* we always start capturing at the start of the buffer
|
||||||
* and use it as a circular buffer
|
* and use it as a circular buffer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
PORTD = B10000000; /* debug timing measurement */
|
DEBUG_ON; /* debug timing measurement */
|
||||||
while ((trigger_values ^ (logicdata[logicIndex] = PINB)) & trigger) {
|
while ((trigger_values ^ (logicdata[logicIndex] = CHANPIN)) & trigger) {
|
||||||
/* PORTD = B00000000; */
|
/* DEBUG_OFF; */
|
||||||
/* increment index. */
|
/* increment index. */
|
||||||
logicIndex++;
|
logicIndex++;
|
||||||
if (logicIndex >= readCount) {
|
if (logicIndex >= readCount) {
|
||||||
logicIndex = 0;
|
logicIndex = 0;
|
||||||
}
|
}
|
||||||
/* PORTD = B10000000; */
|
else {
|
||||||
|
/* pad the same number of cycles as the above assignment (needs verification) */
|
||||||
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
}
|
}
|
||||||
PORTD = B00000000; /* debug timing measurement */
|
delayMicroseconds(delayTime - 3);
|
||||||
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
|
/* DEBUG_ON; */
|
||||||
|
}
|
||||||
|
DEBUG_OFF; /* debug timing measurement */
|
||||||
|
|
||||||
/* 'logicIndex' now points to trigger sample, keep track of it */
|
/* 'logicIndex' now points to trigger sample, keep track of it */
|
||||||
triggerIndex = logicIndex;
|
triggerIndex = logicIndex;
|
||||||
@@ -641,21 +823,24 @@ void triggerMicro() {
|
|||||||
* This needs adjustment so that we have the right spacing between the
|
* This needs adjustment so that we have the right spacing between the
|
||||||
* before trigger samples and the after trigger samples.
|
* before trigger samples and the after trigger samples.
|
||||||
*/
|
*/
|
||||||
delayMicroseconds(delayTime);
|
delayMicroseconds(delayTime - 2);
|
||||||
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
|
__asm__("nop\n\t""nop\n\t""nop\n\t");
|
||||||
|
|
||||||
/* keep sampling for delayCount after trigger */
|
/* keep sampling for delayCount after trigger */
|
||||||
PORTD = B10000000; /* debug timing measurement */
|
DEBUG_ON; /* debug timing measurement */
|
||||||
for (i = 0 ; i < delayCount; i++) {
|
for (i = 0 ; i < delayCount; i++) {
|
||||||
if (logicIndex >= readCount) {
|
if (logicIndex >= readCount) {
|
||||||
logicIndex = 0;
|
logicIndex = 0;
|
||||||
}
|
}
|
||||||
logicdata[logicIndex++] = PINB;
|
logicdata[logicIndex++] = CHANPIN;
|
||||||
delayMicroseconds(delayTime - 3);
|
delayMicroseconds(delayTime - 3);
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||||
__asm__("nop\n\t""nop\n\t""nop\n\t");
|
__asm__("nop\n\t""nop\n\t""nop\n\t");
|
||||||
}
|
}
|
||||||
PORTD = B00000000; /* debug timing measurement */
|
DEBUG_OFF; /* debug timing measurement */
|
||||||
delayMicroseconds(100);
|
delayMicroseconds(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -676,7 +861,11 @@ void triggerMicro() {
|
|||||||
if (logicIndex >= readCount) {
|
if (logicIndex >= readCount) {
|
||||||
logicIndex = 0;
|
logicIndex = 0;
|
||||||
}
|
}
|
||||||
Serial.print(logicdata[logicIndex++], BYTE);
|
#ifdef USE_PORTD
|
||||||
|
client.write(logicdata[logicIndex++] >> 2);
|
||||||
|
#else
|
||||||
|
client.write(logicdata[logicIndex++]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,43 +901,69 @@ void setupDelay() {
|
|||||||
*/
|
*/
|
||||||
void get_metadata() {
|
void get_metadata() {
|
||||||
/* device name */
|
/* device name */
|
||||||
Serial.print(0x01, BYTE);
|
client.write((uint8_t)0x01);
|
||||||
Serial.print('A', BYTE);
|
client.write('A');
|
||||||
Serial.print('G', BYTE);
|
client.write('G');
|
||||||
Serial.print('L', BYTE);
|
client.write('L');
|
||||||
Serial.print('A', BYTE);
|
client.write('A');
|
||||||
Serial.print('v', BYTE);
|
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
Serial.print('0', BYTE);
|
client.write('M');
|
||||||
Serial.print(0x00, BYTE);
|
#endif /* Mega */
|
||||||
|
client.write('v');
|
||||||
|
client.write('0');
|
||||||
|
client.write((uint8_t)0x00);
|
||||||
|
|
||||||
/* sample memory (1024) */
|
/* firmware version */
|
||||||
Serial.print(0x21, BYTE);
|
client.write((uint8_t)0x02);
|
||||||
Serial.print(0x00, BYTE);
|
client.write('0');
|
||||||
Serial.print(0x00, BYTE);
|
client.write('.');
|
||||||
Serial.print(0x04, BYTE);
|
client.write('0');
|
||||||
Serial.print(0x00, BYTE);
|
client.write('9');
|
||||||
|
client.write((uint8_t)0x00);
|
||||||
|
|
||||||
|
/* sample memory */
|
||||||
|
client.write((uint8_t)0x21);
|
||||||
|
client.write((uint8_t)0x00);
|
||||||
|
client.write((uint8_t)0x00);
|
||||||
|
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
|
/* 7168 bytes */
|
||||||
|
client.write((uint8_t)0x1C);
|
||||||
|
client.write((uint8_t)0x00);
|
||||||
|
#elif defined(__AVR_ATmega328P__)
|
||||||
|
/* 1024 bytes */
|
||||||
|
client.write((uint8_t)0x04);
|
||||||
|
client.write((uint8_t)0x00);
|
||||||
|
#else
|
||||||
|
/* 532 bytes */
|
||||||
|
client.write((uint8_t)0x02);
|
||||||
|
client.write((uint8_t)0x14);
|
||||||
|
#endif /* Mega */
|
||||||
|
|
||||||
/* sample rate (1MHz) */
|
/* sample rate (1MHz) */
|
||||||
Serial.print(0x23, BYTE);
|
client.write((uint8_t)0x23);
|
||||||
Serial.print(0x00, BYTE);
|
client.write((uint8_t)0x00);
|
||||||
Serial.print(0x0F, BYTE);
|
client.write((uint8_t)0x0F);
|
||||||
Serial.print(0x42, BYTE);
|
client.write((uint8_t)0x42);
|
||||||
Serial.print(0x40, BYTE);
|
client.write((uint8_t)0x40);
|
||||||
|
|
||||||
/* number of probes (5 by default) */
|
/* number of probes (6 by default on Arduino, 8 on Mega) */
|
||||||
Serial.print(0x40, BYTE);
|
client.write((uint8_t)0x40);
|
||||||
#ifdef CHAN5
|
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
Serial.print(0x06, BYTE);
|
client.write((uint8_t)0x08);
|
||||||
#else
|
#else
|
||||||
Serial.print(0x05, BYTE);
|
#ifdef CHAN5
|
||||||
|
client.write((uint8_t)0x06);
|
||||||
|
#else
|
||||||
|
client.write((uint8_t)0x05);
|
||||||
#endif /* CHAN5 */
|
#endif /* CHAN5 */
|
||||||
|
#endif /* Mega */
|
||||||
|
|
||||||
/* protocol version (2) */
|
/* protocol version (2) */
|
||||||
Serial.print(0x41, BYTE);
|
client.write((uint8_t)0x41);
|
||||||
Serial.print(0x02, BYTE);
|
client.write((uint8_t)0x02);
|
||||||
|
|
||||||
/* end of data */
|
/* end of data */
|
||||||
Serial.print(0x00, BYTE);
|
client.write((uint8_t)0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -761,34 +976,36 @@ void debugprint() {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
Serial.print("divider = ");
|
client.print("divider = ");
|
||||||
Serial.println(divider, DEC);
|
client.println(divider, DEC);
|
||||||
Serial.print("delayTime = ");
|
client.print("delayTime = ");
|
||||||
Serial.println(delayTime, DEC);
|
client.println(delayTime, DEC);
|
||||||
Serial.print("trigger_values = ");
|
client.print("trigger_values = ");
|
||||||
Serial.println(trigger_values, BIN);
|
client.println(trigger_values, BIN);
|
||||||
#endif
|
#endif
|
||||||
Serial.print("readCount = ");
|
client.print("readCount = ");
|
||||||
Serial.println(readCount, DEC);
|
client.println(readCount, DEC);
|
||||||
Serial.print("delayCount = ");
|
client.print("delayCount = ");
|
||||||
Serial.println(delayCount, DEC);
|
client.println(delayCount, DEC);
|
||||||
Serial.print("logicIndex = ");
|
client.print("logicIndex = ");
|
||||||
Serial.println(logicIndex, DEC);
|
client.println(logicIndex, DEC);
|
||||||
Serial.print("triggerIndex = ");
|
client.print("triggerIndex = ");
|
||||||
Serial.println(triggerIndex, DEC);
|
client.println(triggerIndex, DEC);
|
||||||
|
client.print("rleEnabled = ");
|
||||||
|
client.println(rleEnabled, DEC);
|
||||||
|
|
||||||
Serial.println("Bytes:");
|
client.println("Bytes:");
|
||||||
|
|
||||||
for (i = 0 ; i < savecount; i++) {
|
for (i = 0 ; i < savecount; i++) {
|
||||||
if (savebytes[i] == 0x20) {
|
if (savebytes[i] == 0x20) {
|
||||||
Serial.println();
|
client.println();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Serial.print(savebytes[i], HEX);
|
client.print(savebytes[i], HEX);
|
||||||
Serial.print(' ', BYTE);
|
client.write(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Serial.println("done...");
|
client.println("done...");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -799,13 +1016,17 @@ void debugdump() {
|
|||||||
int i;
|
int i;
|
||||||
int j = 1;
|
int j = 1;
|
||||||
|
|
||||||
Serial.print("\r\n");
|
client.print("\r\n");
|
||||||
|
|
||||||
for (i = 0 ; i < MAX_CAPTURE_SIZE; i++) {
|
for (i = 0 ; i < MAX_CAPTURE_SIZE; i++) {
|
||||||
Serial.print(logicdata[i], HEX);
|
#ifdef USE_PORTD
|
||||||
Serial.print(" ");
|
client.print(logicdata[i] >> 2, HEX);
|
||||||
|
#else
|
||||||
|
client.print(logicdata[i], HEX);
|
||||||
|
#endif
|
||||||
|
client.print(" ");
|
||||||
if (j == 32) {
|
if (j == 32) {
|
||||||
Serial.print("\r\n");
|
client.print("\r\n");
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
@@ -814,3 +1035,9 @@ void debugdump() {
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ device.description = Arduino Generic Logic Analyzer
|
|||||||
# The device interface, SERIAL only
|
# The device interface, SERIAL only
|
||||||
device.interface = SERIAL
|
device.interface = SERIAL
|
||||||
# The device's native clockspeed, in Hertz.
|
# The device's native clockspeed, in Hertz.
|
||||||
device.clockspeed = 100000000
|
device.clockspeed = 16000000
|
||||||
# Whether or not double-data-rate is supported by the device (also known as the "demux"-mode).
|
# Whether or not double-data-rate is supported by the device (also known as the "demux"-mode).
|
||||||
device.supports_ddr = false
|
device.supports_ddr = false
|
||||||
# Supported sample rates in Hertz, separated by comma's
|
# Supported sample rates in Hertz, separated by comma's
|
||||||
@@ -19,7 +19,7 @@ device.capturesizes = 64, 128, 256, 512, 1024
|
|||||||
# Whether or not the noise filter is supported
|
# Whether or not the noise filter is supported
|
||||||
device.feature.noisefilter = false
|
device.feature.noisefilter = false
|
||||||
# Whether or not Run-Length encoding is supported
|
# Whether or not Run-Length encoding is supported
|
||||||
device.feature.rle = false
|
device.feature.rle = true
|
||||||
# Whether or not a testing mode is supported
|
# Whether or not a testing mode is supported
|
||||||
device.feature.testmode = false
|
device.feature.testmode = false
|
||||||
# Whether or not triggers are supported
|
# Whether or not triggers are supported
|
||||||
@@ -30,7 +30,7 @@ device.trigger.stages = 1
|
|||||||
device.trigger.complex = false
|
device.trigger.complex = false
|
||||||
|
|
||||||
# The total number of channels usable for capturing
|
# The total number of channels usable for capturing
|
||||||
device.channel.count = 5
|
device.channel.count = 6
|
||||||
# The number of channels groups, together with the channel count determines the channels per group
|
# The number of channels groups, together with the channel count determines the channels per group
|
||||||
device.channel.groups = 1
|
device.channel.groups = 1
|
||||||
# Whether the capture size is limited by the enabled channel groups
|
# Whether the capture size is limited by the enabled channel groups
|
||||||
@@ -39,13 +39,15 @@ device.capturesize.bound = false
|
|||||||
device.channel.numberingschemes = DEFAULT
|
device.channel.numberingschemes = DEFAULT
|
||||||
|
|
||||||
# Is a delay after opening the port and device detection needed? (0 = no delay, >0 = delay in milliseconds)
|
# Is a delay after opening the port and device detection needed? (0 = no delay, >0 = delay in milliseconds)
|
||||||
device.open.portdelay = 500
|
device.open.portdelay = 1500
|
||||||
|
# The receive timeout for the device (in milliseconds, 100 = default, <=0 = no timeout)
|
||||||
|
device.receive.timeout = 100
|
||||||
# Does the device need a high or low DTR-line to operate correctly? (high = true, low = false)
|
# Does the device need a high or low DTR-line to operate correctly? (high = true, low = false)
|
||||||
device.open.portdtr = true
|
device.open.portdtr = true
|
||||||
# Which metadata keys correspond to this device profile? Value is a comma-separated list of (double quoted) names...
|
# Which metadata keys correspond to this device profile? Value is a comma-separated list of (double quoted) names...
|
||||||
device.metadata.keys = "AGLAv0"
|
device.metadata.keys = "AGLAv0"
|
||||||
|
|
||||||
# In which order are samples sent back from the device? true = last sample first, false = first sample first
|
# In which order are samples sent back from the device? false = last sample first, true = first sample first
|
||||||
device.samples.reverseOrder = false
|
device.samples.reverseOrder = true
|
||||||
|
|
||||||
###EOF###
|
###EOF###
|
||||||
|
|||||||
53
ols.profile-aglam.cfg
Normal file
53
ols.profile-aglam.cfg
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Configuration for Arduino Mega Logic Analyzer profile
|
||||||
|
|
||||||
|
# The short (single word) type of the device described in this profile
|
||||||
|
device.type = AGLAM
|
||||||
|
# A longer description of the device
|
||||||
|
device.description = Arduino Mega Logic Analyzer
|
||||||
|
# The device interface, SERIAL only
|
||||||
|
device.interface = SERIAL
|
||||||
|
# The device's native clockspeed, in Hertz.
|
||||||
|
device.clockspeed = 16000000
|
||||||
|
# Whether or not double-data-rate is supported by the device (also known as the "demux"-mode).
|
||||||
|
device.supports_ddr = false
|
||||||
|
# Supported sample rates in Hertz, separated by comma's
|
||||||
|
device.samplerates = 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000
|
||||||
|
# What capture clocks are supported
|
||||||
|
device.captureclock = INTERNAL
|
||||||
|
# The supported capture sizes, in bytes
|
||||||
|
device.capturesizes = 64, 128, 256, 512, 1024, 2048, 4096, 7168
|
||||||
|
# Whether or not the noise filter is supported
|
||||||
|
device.feature.noisefilter = false
|
||||||
|
# Whether or not Run-Length encoding is supported
|
||||||
|
device.feature.rle = false
|
||||||
|
# Whether or not a testing mode is supported
|
||||||
|
device.feature.testmode = false
|
||||||
|
# Whether or not triggers are supported
|
||||||
|
device.feature.triggers = true
|
||||||
|
# The number of trigger stages
|
||||||
|
device.trigger.stages = 1
|
||||||
|
# Whether or not "complex" triggers are supported
|
||||||
|
device.trigger.complex = false
|
||||||
|
|
||||||
|
# The total number of channels usable for capturing
|
||||||
|
device.channel.count = 8
|
||||||
|
# The number of channels groups, together with the channel count determines the channels per group
|
||||||
|
device.channel.groups = 1
|
||||||
|
# Whether the capture size is limited by the enabled channel groups
|
||||||
|
device.capturesize.bound = false
|
||||||
|
# Which numbering does the device support
|
||||||
|
device.channel.numberingschemes = DEFAULT
|
||||||
|
|
||||||
|
# Is a delay after opening the port and device detection needed? (0 = no delay, >0 = delay in milliseconds)
|
||||||
|
device.open.portdelay = 2000
|
||||||
|
# The receive timeout for the device (in milliseconds, 100 = default, <=0 = no timeout)
|
||||||
|
device.receive.timeout = 100
|
||||||
|
# Does the device need a high or low DTR-line to operate correctly? (high = true, low = false)
|
||||||
|
device.open.portdtr = true
|
||||||
|
# Which metadata keys correspond to this device profile? Value is a comma-separated list of (double quoted) names...
|
||||||
|
device.metadata.keys = "AGLAMv0"
|
||||||
|
|
||||||
|
# In which order are samples sent back from the device? false = last sample first, true = first sample first
|
||||||
|
device.samples.reverseOrder = true
|
||||||
|
|
||||||
|
###EOF###
|
||||||
Reference in New Issue
Block a user