Show Posts
Pages: 1 [2] 3 4 5
16  Development / Other Software Development / Re: Program loader for networked machines on: March 13, 2011, 07:08:44 pm
Ahhhhhh thanks - I was trying to be too logical - so the format is
first character is a byte, all following are hex pairs forming a byte.
17  Development / Other Software Development / Program loader for networked machines on: March 13, 2011, 02:42:18 pm
I need to build a program loader that plays with the standard bootloaders but operates over a TCPIP network (encrypted or cleartext.)
The first steps indicate a mismatch between the IDE-generated hex files and the Intel hex format they presumably follow.
Quote
Fade.hex:

3A 31 30 30 30 30 30 30 30 30 43 39 34 36 31 30 30 30 43 39 34 37 45 30 30 30 43 39 34 37 45 30 30 30 43 39 34 37 45 30 30 39 35 0D 0A 3A 31 ...

Intel load format:

Record mark | Rec. length | offset | rectype | info/data | cksum
1-byte       1-byte       2-bytes 1-byte    n-bytes     1-byte
Each record begins with a RECORD MARK field containing 03AH, the ASCII code for the colon(':')

Notice that 0x31 is a record length (byte 1), but the next record starts earlier (next 0x3A).
I hope I'm wrong instead of the format and somebody can point out the error.

In this project I'm trying to stay away from specific hardware, but the basic foundation is a serial tunnel device such as the Ethernet shield.
I am testing some code borrowed from http://arduino.cc/forum/index.php/topic,46486.0.html
and it indicates that there are different bootloaders floating about - mucking about with the standard bootloader may just kill this project. I get different responses depending on whose 328p board I use.
18  Using Arduino / Networking, Protocols, and Devices / Uploading hex over tcpip in arduino network on: March 07, 2011, 01:13:07 pm
I am visualizing a large network of several hundred arduinos (328p) connected over TCPIP and Xbee's.
I need to find a solution to program these remotely by addressing each node and sending it a modified
hex file. The network control language is Java.
From what I have seen so far it seems I may have to invoke Avrdude from inside Java and give it the
tcp port to transmit over; the Java program would ensure the stream is directed to the appropriate
XBee-connected Arduino. However, the Avrdude docs state that TCP port addressing is not supported
under Windows. That seems to break my strategy. Any other ideas, anybody, please?
I suppose since I'm on Java I could move to 'Unix' or Mac instead.
19  Using Arduino / Networking, Protocols, and Devices / Re: SPI slave select line glitch on: February 20, 2011, 03:30:39 pm
Looks like this may be a problem with the display instrumentation.
If I remove CLK from the display I don't see the glitches any more.
Thanks for the comments everybody. I will talk to the guys that
built the MSO19 I'm using.  smiley-mad
OTOH the MSO19 is attached to a 2.4 GHz dual processor Windows server and the fast
sample/display may be more than ol' Windows can handle on that machine.
Will try on an XP asap.
20  Using Arduino / Networking, Protocols, and Devices / SPI slave select line glitch on: February 18, 2011, 06:55:51 pm
I noticed during SPI testing that there is a weird glitch in the SS line. Maybe it's my fault - would be glad to hear that.
Here's my code:
Code:
#include <SPI.h>

const int sspin = 10;
const int mosipin = 11;
byte val = 0x18;

void setup()
{
// Digital pins are: SS=10, MOSI=11, MISO=12, SCK=13
pinMode (sspin, OUTPUT); // must be guaranteed to be output
pinMode (mosipin, OUTPUT);
SPI.setClockDivider(SPI_CLOCK_DIV32); // => 500 KHz
SPI.setBitOrder(MSBFIRST); // endian
SPI.setDataMode(SPI_MODE0); // clock idles low
SPI.begin(); // => SCK and MOSI low, SS high
}


void loop()
{
digitalWrite(sspin, LOW); // enable slave
SPI.transfer(val);
digitalWrite(sspin, HIGH); // disable slave
}

And here's the trace - notice the quick bursts in the SS line
Can~t insert image - attached instead (however that works)
21  Forum 2005-2010 (read only) / Syntax & Programs / Re: What's wrong with this c++ code? on: April 09, 2010, 07:06:43 pm
Thanks to both of you! The problem was that the default constructor also needed an initialization for Nss  --> softxbee::softxbee() : Nss(2,1)
so I gave it pins 1 and 2 as a default.

My own problem is that I've been doing Java for so long that stepping back into the medieval world of C++ with all its contrived artifacts is a serious drag for me. However, I do recognize we'd need at least a 100MHz Arduino to support Java.
22  Forum 2005-2010 (read only) / Syntax & Programs / Re: What's wrong with this c++ code? on: April 09, 2010, 02:21:03 pm
Thanks, Cr0sh - changing the include doesn't affect the problem.
I'm just trying to instantiate a NewSoftSerial object when the softxbee constructor is called.Maybe you could find a similar line in your code.
Will try some more. Found:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1211645129

but his solution doesn't seem to help me here.
23  Forum 2005-2010 (read only) / Syntax & Programs / What's wrong with this c++ code? on: April 09, 2010, 12:26:18 pm
I am converting the Xbee library to use both Serial and NewSoftSerial, so it can be used in conjunction with USB access to the mcu. But I'm not sure why I'm getting this error:

softxbee.cpp: In member function 'void softxbee::begin(long int)':
softxbee.cpp:23: error: '((softxbee*)this)->softxbee::Nss' does not have class type

.h:
Code:
#ifndef softxbee_h
#define softxbee_h

#include <WProgram.h>
#include <inttypes.h>
#include <../NewSoftSerial/NewSoftSerial.h>

class softxbee {
public:
      softxbee();
      softxbee(uint8_t, uint8_t);

      uint8_t _rxpin, _txpin;
      boolean _usingsoftserial;
      NewSoftSerial& Nss(uint8_t, uint8_t);
      void begin(long baud);
};

#endif //softxbee _h

.cpp:
Code:
#include "softxbee.h"
#include "WProgram.h"
#include "HardwareSerial.h"
#include <../NewSoftSerial/NewSoftSerial.h>


softxbee::softxbee(){
      _usingsoftserial = false;
}

softxbee::softxbee(uint8_t rxpin, uint8_t txpin){
      softxbee();
      _usingsoftserial = true;
      _rxpin = rxpin;
      _txpin = txpin;
      Nss(rxpin, txpin);
}

void softxbee::begin(long baud) {
      if (!_usingsoftserial)
            Serial.begin(baud);
      else
            Nss.begin(baud);
}

My sketch to test this:
Code:
#include      <softxbee.h>
#include      <NewSoftSerial.h>

softxbee xbee;                                                // coordinator
 
void setup()
{
Serial.begin(9600);
xbee = softxbee(8,9);
xbee.begin(9600);
}

void loop()
{
}
24  Forum 2005-2010 (read only) / Syntax & Programs / Re: Multiple functions one button on: April 01, 2010, 12:48:13 pm
Why can't you have arduino count the number of times your button does, say take a digital line low or high?
25  Forum 2005-2010 (read only) / Syntax & Programs / Re: Communications protocol over newsoftserial on: May 11, 2009, 10:38:45 am
This was fixed by a) reducing speed to 2400 and b) removing hardware handshaking. Conclusion is that newsoftserial cannot support hadware handshaking.
26  Forum 2005-2010 (read only) / Syntax & Programs / Re: Communications protocol over newsoftserial on: May 08, 2009, 11:32:11 am
I guess this loop member takes a little getting used to; I managed to get things rational with this code:

void loop()
{
if (commport.available() != 0)
      {
      c = (char)commport.read();
      input[counter++] = c;
      commport.flush();
      counter = 0;
      if (input[0] == '1')
            {
            Serial.print("received ");
            Serial.println(input);
            commport.print("1");
            commport.print("2");
            input[0] = 0;
            }
      else
            Serial.println("got garbage");
      }
}

I will play with this code and see were the problem was exactly - I don't see why sending 1 and 2 out should affect input counts in available(). The applet code is:

header[0] = '1';                                          // send request for ROM value
gtp.send(header);
header = gtp.receive();
if (header[0] == '1')
      {
      System.out.println("got 1 back");
      msgbody = gtp.receive();
      msgbodystring = new String(msgbody);
      System.out.println("got " + msgbodystring + " after that");
      address.setText(msgbodystring);
      }
else
      System.out.println("got garbage");

where gtp is a Java socket i/o handler and is called only once.

Ooops - spoke too soon: now I don't get the '2' back from newsoftserial.
27  Forum 2005-2010 (read only) / Syntax & Programs / Re: Communications protocol over newsoftserial on: May 07, 2009, 04:09:32 pm
Thanks for the reply, but that is innocuous and definitely not the problem.

Oh, I see where mikalhart knows that newsoftserial doesn't work right under v15. Need to wait, I guess.
28  Forum 2005-2010 (read only) / Syntax & Programs / Communications protocol over newsoftserial on: May 07, 2009, 03:44:47 pm
I am using newsoftserial8 at 9600 baud on a 328 under v15; this loop is supposed to read a character from an applet on the xport and reply; instead it goes into an infinite loop and keeps receiving characters when no more are being sent.



void loop()
{
if (commport.available() != 0)
      {
      c = (char)commport.read();
      input[counter++] = c;
      }
commport.flush();
counter = 0;
if (input[0] == '1')
      {
      Serial.print("received ");
      Serial.println(input);
      }
else
      Serial.println("got garbage");
commport.print("1");
commport.print("2");
}
29  Forum 2005-2010 (read only) / Syntax & Programs / Re: Reading my own pwm-generated voltage on: April 30, 2009, 06:11:49 pm
You're right - need either pin 2 or 3 and appropriate interrupt.
Tried that - interrupt service is for pin 2 and in the routine I try to read the analog pin 0. No dice.
I think this is not doable because interrupts are being soaked up by the pwm generator.
30  Forum 2005-2010 (read only) / Syntax & Programs / Re: Reading my own pwm-generated voltage on: April 29, 2009, 05:35:24 pm
Hi Anachrocomputer - thanks for the reply, but I need the actual value of the pwm after it hits the resistive circuit - if somebody changes the resistance that will change the pwm voltage and I have to know by how much. In fact I need both the high and low voltage parts because that tells me there is a diode in the circuit and the change in resistance is warranted.

I thought the interrupt service routine doesn't apply to any particular pin.

Right now my println always returns 0.

I tried both interrupt channels (0 and 1.)
Pages: 1 [2] 3 4 5