2 Commits

Author SHA1 Message Date
Andrew Gillham
cebcba7d6c Fix ATmega168 comment. 2011-11-04 18:31:11 -07:00
Andrew Gillham
5734af2468 Fix check for ATmega328
The define is __AVR_ATmega328P__ (note the 'P')
2011-11-04 18:26:17 -07:00
4 changed files with 56 additions and 75 deletions

5
README
View File

@@ -48,8 +48,5 @@ 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.
Release: v0.06 November 4, 2011.
Release: v0.05 November 4, 2011.

View File

@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: logic_analyzer.ino,v 1.21 2012/02/27 20:19:44 gillham Exp $
* $Id: logic_analyzer.pde,v 1.17 2011-08-04 02:31:01 gillham Exp $
*
*/
@@ -78,7 +78,7 @@
* until after the trigger fires.
* Please try it out and report back.
*
* Release: v0.06 November 4, 2011.
* Release: v0.05 November 4, 2011.
*
*/
@@ -152,14 +152,14 @@ void debugdump(void);
* ATmega2560: 7168 (or lower)
*/
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define DEBUG_CAPTURE_SIZE 7168
#define CAPTURE_SIZE 7168
#define DEBUG_CAPTURE_SIZE 7168
#define CAPTURE_SIZE 7168
#elif defined(__AVR_ATmega328P__)
#define DEBUG_CAPTURE_SIZE 1024
#define CAPTURE_SIZE 1024
#define DEBUG_CAPTURE_SIZE 1024
#define CAPTURE_SIZE 1024
#else
#define DEBUG_CAPTURE_SIZE 532
#define CAPTURE_SIZE 532
#define DEBUG_CAPTURE_SIZE 532
#define CAPTURE_SIZE 532
#endif
#define DEBUG
@@ -239,10 +239,10 @@ void loop()
break;
case SUMP_QUERY:
/* return the expected bytes. */
Serial.write('1');
Serial.write('A');
Serial.write('L');
Serial.write('S');
Serial.print('1', BYTE);
Serial.print('A', BYTE);
Serial.print('L', BYTE);
Serial.print('S', BYTE);
break;
case SUMP_ARM:
/*
@@ -513,7 +513,7 @@ void captureMicro() {
* is done for any triggers, this is effectively the 0/100 buffer split.
*/
for (i = 0 ; i < readCount; i++) {
Serial.write(logicdata[i]);
Serial.print(logicdata[i], BYTE);
}
}
@@ -549,7 +549,7 @@ void captureMilli() {
delay(delayTime);
}
for (i = 0 ; i < readCount; i++) {
Serial.write(logicdata[i]);
Serial.print(logicdata[i], BYTE);
}
}
@@ -682,12 +682,6 @@ void triggerMicro() {
if (logicIndex >= readCount) {
logicIndex = 0;
}
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");
}
delayMicroseconds(delayTime - 3);
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
/* PORTD = B10000000; */
}
PORTD = B00000000; /* debug timing measurement */
@@ -699,10 +693,7 @@ void triggerMicro() {
* This needs adjustment so that we have the right spacing between the
* before trigger samples and the after trigger samples.
*/
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");
delayMicroseconds(delayTime);
/* keep sampling for delayCount after trigger */
PORTD = B10000000; /* debug timing measurement */
@@ -737,7 +728,7 @@ void triggerMicro() {
if (logicIndex >= readCount) {
logicIndex = 0;
}
Serial.write(logicdata[logicIndex++]);
Serial.print(logicdata[logicIndex++], BYTE);
}
}
@@ -773,61 +764,61 @@ void setupDelay() {
*/
void get_metadata() {
/* device name */
Serial.write((uint8_t)0x01);
Serial.write('A');
Serial.write('G');
Serial.write('L');
Serial.write('A');
Serial.print(0x01, BYTE);
Serial.print('A', BYTE);
Serial.print('G', BYTE);
Serial.print('L', BYTE);
Serial.print('A', BYTE);
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
Serial.write('M');
Serial.print('M', BYTE);
#endif /* Mega */
Serial.write('v');
Serial.write('0');
Serial.write((uint8_t)0x00);
Serial.print('v', BYTE);
Serial.print('0', BYTE);
Serial.print(0x00, BYTE);
/* sample memory */
Serial.write((uint8_t)0x21);
Serial.write((uint8_t)0x00);
Serial.write((uint8_t)0x00);
Serial.print(0x21, BYTE);
Serial.print(0x00, BYTE);
Serial.print(0x00, BYTE);
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
/* 7168 bytes */
Serial.write((uint8_t)0x1C);
Serial.write((uint8_t)0x00);
Serial.print(0x1C, BYTE);
Serial.print(0x00, BYTE);
#elif defined(__AVR_ATmega328P__)
/* 1024 bytes */
Serial.write((uint8_t)0x04);
Serial.write((uint8_t)0x00);
Serial.print(0x04, BYTE);
Serial.print(0x00, BYTE);
#else
/* 532 bytes */
Serial.write((uint8_t)0x02);
Serial.write((uint8_t)0x14);
Serial.print(0x02, BYTE);
Serial.print(0x14, BYTE);
#endif /* Mega */
/* sample rate (1MHz) */
Serial.write((uint8_t)0x23);
Serial.write((uint8_t)0x00);
Serial.write((uint8_t)0x0F);
Serial.write((uint8_t)0x42);
Serial.write((uint8_t)0x40);
Serial.print(0x23, BYTE);
Serial.print(0x00, BYTE);
Serial.print(0x0F, BYTE);
Serial.print(0x42, BYTE);
Serial.print(0x40, BYTE);
/* number of probes (5 by default on Arduino, 8 on Mega) */
Serial.write((uint8_t)0x40);
Serial.print(0x40, BYTE);
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
Serial.write((uint8_t)0x08);
Serial.print(0x08, BYTE);
#else
#ifdef CHAN5
Serial.write((uint8_t)0x06);
Serial.print(0x06, BYTE);
#else
Serial.write((uint8_t)0x05);
Serial.print(0x05, BYTE);
#endif /* CHAN5 */
#endif /* Mega */
/* protocol version (2) */
Serial.write((uint8_t)0x41);
Serial.write((uint8_t)0x02);
Serial.print(0x41, BYTE);
Serial.print(0x02, BYTE);
/* end of data */
Serial.write((uint8_t)0x00);
Serial.print(0x00, BYTE);
}
/*
@@ -864,7 +855,7 @@ void debugprint() {
}
else {
Serial.print(savebytes[i], HEX);
Serial.write(' ');
Serial.print(' ', BYTE);
}
}
Serial.println("done...");
@@ -893,6 +884,3 @@ void debugdump() {
#endif /* DEBUG */

View File

@@ -7,7 +7,7 @@ device.description = Arduino Generic Logic Analyzer
# The device interface, SERIAL only
device.interface = SERIAL
# The device's native clockspeed, in Hertz.
device.clockspeed = 16000000
device.clockspeed = 100000000
# 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
@@ -39,15 +39,13 @@ device.capturesize.bound = false
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 = 1500
# The receive timeout for the device (in milliseconds, 100 = default, <=0 = no timeout)
device.receive.timeout = 100
device.open.portdelay = 500
# 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 = "AGLAv0"
# In which order are samples sent back from the device? false = last sample first, true = first sample first
device.samples.reverseOrder = true
# In which order are samples sent back from the device? true = last sample first, false = first sample first
device.samples.reverseOrder = false
###EOF###

View File

@@ -7,7 +7,7 @@ device.description = Arduino Mega Logic Analyzer
# The device interface, SERIAL only
device.interface = SERIAL
# The device's native clockspeed, in Hertz.
device.clockspeed = 16000000
device.clockspeed = 100000000
# 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
@@ -39,15 +39,13 @@ device.capturesize.bound = false
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
device.open.portdelay = 1000
# 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
# In which order are samples sent back from the device? true = last sample first, false = first sample first
device.samples.reverseOrder = false
###EOF###