Show Posts
Pages: [1] 2
1  Products / Arduino Due / Re: 5100 ethernet and Due on: April 17, 2014, 12:31:54 am
Couldn't find a Remove button.

But back to the plot - here's a note on how I resolved the issue for anyone facing similar issues in future.

My problems with the w5100 on the Due disappeared when I reinstalled the IDE (I used the nightly build as of 14 April 14 but I am pretty sure that the current beta of 1.5.6r2 would have been OK too) and moved my sketch into that hierarchy. Previously I had been using a custom location for sketches and libraries (in an attempt to be able to edit sketches under both IDE 1.0.4 and also under ERW 1.0.5 when the extra functions were of value) and clearly the compilation was pikcing up the wrong versions of libraries.

One oddity - I couldn't get output via FTDI to work on the Due's Serial1 with the w5100 connected (which had been OK on a Mega) but all was fine using Serial2.

2  Products / Arduino Due / Re: DS18B20 Temperature Sensor - 5v supply, 3.3v data? on: April 16, 2014, 10:02:31 am
Update on the unexpected 5v pulses on the Onewire Data line:

Using a Mega (Data on Pin 10 connected via 4k7 pullup to 3.3v) , with Onewire Vdd reduced to 3.3v, the Mega reads the DS1820 OK, but the scope STILL shows spikes of 5v. This can't be coming from the OneWire (which isn't getting a sniff of any 5v), so it must be some sort of intermittent pullup within the Mega - which makes me more confident to try the same configuration on the Due - where any internal pullup would be to 3.3v.

There is also a confirming quote attributed to DS1820 manufacturer Dallas  on this Raspberry Pi thread (http://93.93.128.176/forums/viewtopic.php?t=30359&p=266106):
Yes, you can make VDD = 5V and Vpullup = 3.3V. The Data line (DQ) is open-drain so it can only go as high as the Vpullup voltage.

But I'd still like to understand why I see those 5v pulses, if anyone can help.
3  Products / Arduino Due / DS18B20 Temperature Sensor - 5v supply, 3.3v data? on: April 16, 2014, 03:42:09 am
I want to read multiple DS1820 sensors using a Due. I have circuitry and sketch working happily on a Mega: but I wanted to check that it would be safe for my Due.

Clearly, the data pullup needs to be to 3.3v rather than 5v. But there are several suggestions that the Vdd for the Onewire network could be at 5v without problems because it has an "open drain" (beyond my expertise). Indeed, reading the Dallas paper on power requirements (http://pdfserv.maximintegrated.com/en/an/AN4255.pdf, it looks as if 5v would be far better for multiple sensors on reasonably long cabling if it is safe for the Due.

So, I tested my setup on my Mega, with 5v supply (well, 4.8 to be more accurate) on the Vdd pin and a 4k7 pullup to 3v3 on the data line.

The program runs fine on the Mega with a 3.3v pullup. But when I put a scope on it, the picture is less happy: the Onewire Data signal mostly oscillates between 0v and 3.3v but perhaps one peak in four goes up to 4.7v (screenshot at http://winster.org/DS1820mixedvoltages.png ). Same for several different DS18b20's.

With no DS1820 connected, the Onewire pin on the Mega sits happily at 3.3v so it doesn't look like any internal pullup issue: it does look as if there is some feedback of the 5v via the Onwire Data line.

Can anyone offer insights and recommendations?
4  Products / Arduino Due / Re: Choosing Serial port using #define directive on: April 14, 2014, 01:32:39 pm
Thanks - much much better!
5  Products / Arduino Due / Choosing Serial port using #define directive on: April 14, 2014, 12:42:18 pm
I want to be able to set which Serial port gets my debugging messages, depending on the setting of a single directive.

With Serial 1 to Serial 3, this is simple enough - I make each "print"  using a variable that holds the serial definition, with the definition set using a directive:
Code:
HardwareSerial *mySerialPort;
#ifdef USE_SERIAL2
  mySerialPort=&Serial2;
#else
  mySerialPort=&Serial1;
#endif

mySerialPort->begin(460800);
mySerialPort->println(F("Here is a test message"));


BUT - what if I want the option to use SerialUSB? Trying to set
Code:
mySerialPort=&SerialUSB;

I get "error: cannot convert 'Serial_*' to 'HardwareSerial*' in assignment"

Any suggestions?
6  Products / Arduino Due / Re: 5100 ethernet and Due on: April 13, 2014, 07:58:07 am
Two posts - down to simple incompetence, I'm afraid: sorry. (Can one delete one's own post if one spots a duplicate like this?)

John
7  Products / Arduino Due / 5100 ethernet and Due on: April 13, 2014, 04:30:27 am
I am trying to compile my working-on-a-Mega project for a new Due using IDE 1.5.6r2 - and have got stuck on a problem with W5100.h :

   w5100.h:339: error: 'DDRB' was not declared in this scope

(and similarly for _BV,  and PORTB)

This seems a very fundamental problem, which I am sure has a simple answer. People report managing to make 5100-based ethernet shields work with the Due, but I can't find details of what adaptations are needed. I have found mention of Ethernet52Due.h - but that sounds as if it has been written for the newer w5200 chip.

Ideas, please.
8  Products / Arduino Due / 5100 ethernet and Due on: April 13, 2014, 04:25:23 am
I am trying to compile my working-on-a-Mega project for a new Due - and failing.

There is a problem with W5100.h :
w5100.h:339: error: 'DDRB' was not declared in this scope

9  Using Arduino / Networking, Protocols, and Devices / Re: Maximising Serial output speed to Windows 7 on: November 21, 2013, 06:15:15 am
345600 works for me - on putty and also with TeraTerm. Brilliant: thanks to all for help.

It would be great if Windows-friendly speeds could be added to the baud options in the Arduino Serial Monitor program for Windows - not only to allow use of that program at these speeds, but as a clue to speeds to try with other programs.

John Geddes
10  Using Arduino / Networking, Protocols, and Devices / Maximising Serial output speed to Windows 7 on: November 20, 2013, 03:56:50 am
I am trying to audit the operation of a control application running on a Mega 2560. Everything is working nicely, except for the time it takes to write the audit information via the Serial port to Windows (by the time the Arduino has written all its data for one cycle, I am too late for the next cycle!) 

Clearly, I could try cutting down how much data I send, but I suspect that there is also scope to move data faster from Arduino to Windows 7. I can manage 28800 baud, I can manage 30000, but much beyond that is no good.  I read of others managing better than 100,000 baud - so where should I look for improvements?

It's not the application: the same limit is applying to a naked Mega running the simplest of test programs, eg

Code:
int baudRate[]={9600,14400,19200,28800,38400,57600,115200,230400};
byte a=0;
void setup(){}
void loop(){
  for (byte bIndex=0; bIndex<8; bIndex++){
    Serial.begin (baudRate[bIndex]);
    delay(500);
    Serial.print("a=");
    Serial.print(a);
    Serial.print(" baud=");
    Serial.println(baudRate[bIndex]);
    delay(500);
  }
  a++;
}

Same results if I fix on a single speed and test separately.
Same results on Serial via USB or Serial1 (using Mega 2560) via a separate FTDI adapter to USB.
Same results with different Arduino Mega boards and cables.
Same results on Mega and R3 Uno
Same results with Serial Monitor within ERW 1.0.5, or with RealTerm or Teraterm.
Same results with  SERIAL_BUFFER_SIZE at 64 or 256

Running Windows 7 64-bit on a quad processor
PC reports USB as 1.1 - which would seem to be fast enough.


Ideas, please!
11  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial Monitor for your toolbox - TOOL FINISHED on: November 20, 2013, 02:59:43 am
Sorry if I have missed something, but what is the current status of this? It sounds brilliant, but the only link I can find has a warning above it saying not to download it. Is there a stable version yet: if so, where would I find it?
12  Using Arduino / Project Guidance / Re: Serial output freezes - solved by delay before firing relay on: July 08, 2013, 07:26:42 am
To clarify: I am powering the relay coils from the Mega's own 5v - but each via a transistor, so the quoted 40mA for each coil isn't being taken from the Arduino pins.

But clearly, the power from the coil is adding to the drain on the Mega board. I thought I had read that this was OK for a total of 250 mA (but can't remember where that came from) - but it sounds as if Mega+5100 Ethernet Shield+a couple of LED's doesn't leave enough safety margin for my relay when powered from USB.

The spec page for the Mega (http://arduino.cc/en/Main/arduinoBoardMega2560) mentions a maximum of 500mA via the USB port, but doesn't seem to mention a maximum safe power consumption from the board, either when powered from USB or with a separate supply. Can anyone advise what these limits are, please?

John Geddes

13  Using Arduino / Project Guidance / Re: Serial output freezes - solved by delay before firing relay on: July 08, 2013, 02:10:40 am
Nick - Thanks for running the test.

Can I be clear- was this just a test of the sketch (which runs fine for me too - as long as I don't fit a relay) or was it a physical test with a relay attached?

My hypothesis is that well before hitting the current limits of the board (tested so far only on a Mega 2560), a relay pulse can disrupt Serial output if that is still going on when the relay fires.

If my hypothesis is valid, then it sounds like a generic risk that others might benefit from knowing about. But it clearly could be something specific to my circuitry that has eluded me so far, so if you have run with a relay but without problems that would send me off to do more research.

John
14  Using Arduino / Project Guidance / Re: Serial output freezes - solved by delay before firing relay on: July 07, 2013, 02:27:48 pm
Didn't see that code was really relevant, but in case it helps, here is code that freezes the Serial:

Code:
byte CONST_PIN_RELAY_ON=7;
byte CONST_PIN_RELAY_OFF=6;
 
byte CONST_MSECS_PULSE=20;
byte thisCounter=0;
 
void pulseRelay(boolean pulseDirectionON){
if (pulseDirectionON){
  Serial.println(F("pulseRelay ON"));
  digitalWrite(CONST_PIN_RELAY_ON, 1);   
  delay(CONST_MSECS_PULSE);   
  digitalWrite(CONST_PIN_RELAY_ON, 0);
} else {
  Serial.println(F("pulseRelay OFF"));
  digitalWrite(CONST_PIN_RELAY_OFF, 1);   
  delay(CONST_MSECS_PULSE);   
  digitalWrite(CONST_PIN_RELAY_OFF, 0);
}
}

void setup(){
Serial.begin(9600);
pinMode(CONST_PIN_RELAY_ON, OUTPUT);
pinMode(CONST_PIN_RELAY_OFF, OUTPUT);
}

void loop() {
      Serial.print(F("\nLoop count="));
      Serial.println(thisCounter);
      Serial.println(F("1 Here is a long line which goes on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on"));
      pulseRelay(1);
      Serial.println(F("2 Here is a long line which goes on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on"));
      pulseRelay(0);
      Serial.println(F("3 Here is a long line which goes on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on"));
      thisCounter++;
}
15  Using Arduino / Project Guidance / Serial output freezes - solved by delay before firing relay on: July 07, 2013, 01:28:33 am
Couldn't find this documented elsewhere, so thought an note here might help (and perhaps bring a more refined explanation than my provisional diagnosis).

A simple relay-firing sketch worked fine. The relay (two coil latching 5v, protected by diodes on each coil, each driven via a darlington pair) would fire on and off under control of my Mega 2560 - it takes 40mA and with the odd LED that was still well within the limits of the board.

BUT - in a more complex application using the same circuitry, my (fairly verbose) debugging info written as Serial output would suddenly freeze - in the middle of a line. And it then needed a reset to get Serial output working again.

The answer seems to be that program control moves on to the next line after a Serial.print command without waiting for the line to complete writing: if it is a long line at a low baud rate, it may still be writing when a subsequent line of the program fires the relay (as was the case for me). And something in the relay firing (perhaps just the extra current drain, or could it be something more compled) seems to kill Serial output if that is happening at the same time.

Adding a 200ms delay before each relay operation worked to fix the problem for me. Can anyone offer a more authoritative explanation or a more refined delay value?
Pages: [1] 2