Show Posts
Pages: 1 ... 56 57 [58] 59 60 ... 99
856  Development / Suggestions for the Arduino Project / Re: delay() documentation include interrupt caveat on: July 27, 2012, 09:32:37 am
You can enable interrupts in an ISR and then delay will work.  Just be sure to return from the ISR before the next interrupt from the timer.

I use this trick in a number of libraries to get a high priority thread.  I did a library, WaveHC, for the Adafruit Wave shield that uses this thread to read data from an SD. Thousands of people use this library

It is extremely unlikely that the Arduino team will modify the documentation.  The Arduino corporation take very little input from users.
857  Development / Suggestions for the Arduino Project / Re: Is 1.01 pinMode an improvement? on: July 27, 2012, 09:25:25 am
I really appreciate all of your helpful comments.

I am trying to finish a digital I/O library for advanced users.  Maybe I should go back to my original thought.

void mode(bool) - writes the DDR bit for the Arduino pin.

bool read() - reads the PIN bit for the Arduino pin.

void write(bool) - writes the PORT bit for the Arduino pin.

This would be easy to explain to an advanced user.  I won't worry about beginners.

Here is a test program that makes 125 ns wide pulses for scope tests:
// scope test for write timing
#include <DigitalPin.h>

// class with compile time pin number
DigitalPin<13> pin13;

void setup() {
  // set mode to OUTPUT
void loop() {
high() and low() are the same as write(1) and write(0).  If the argument of write is not a constant, write takes longer than two cycles.  A high address port on a Mega takes much longer for atomic writes.

I also provide a class with run-time pin numbers which takes 13 cycles for atomic writes.  This is still about four times faster than digitalWrite().  13 cycles is for a constant write argument.

This library also has a software SPI class for all SPI modes that runs at about 2 MHz.  Currently I only provide MSB first but it would be easy to support LSB first also. 

I currently use SoftSPI in SdFat for software SPI access to SD cards.  This allows 328 SD shields to be used on Mega and Leonardo without jumpers.

I can't imagine making a reasonable Arduino port for Cortex ARM processors.  I use STM32, LPC, and SAM3.  I would hate being locked into one Atmel processor that the Arduino team picked.
858  Using Arduino / Project Guidance / Re: Checking the accuracy of a DS1340Z RTC using its 512Hz output on: July 26, 2012, 09:54:43 pm
I calibrate RTC chips by connecting a GPS pulse per second signal to a pin with interrupts. 

Connect the RTC sqw to another pin with interrupts.

Count pulses for at least an hour to get the accuracy of the RTC to a ppm.  The GPS pps is accurate to about one microsecond.
859  Development / Suggestions for the Arduino Project / Re: uint_8 or such like on: July 26, 2012, 04:53:18 pm
char, unsigned char, and signed char are three different types.  This bit of C/C++ strangeness happened because a signed type was used for char in C on some early machines and an unsigned type was used on others.

The C/C++ standards have three type of char.

So this compiles:
void f(char x) {Serial.println("char");}
void f(signed char x) {Serial.println("signed char");}
void f(unsigned char x) {Serial.println("unsigned char");}

void setup() {
  f ('H');
void loop() {}
and prints this:
signed char
unsigned char
Other types like short, int, and long are the same as signed short, signed int, and signed long.  

You can't define the functions f(int x) and f(signed int x) in a program like above.

So char is not int8_t or uint8_t.  It may act like one or the other on different machines.

The Arduino group didn't implement this correctly in Print.  print(uint8_t) and print(int8_t) should both print a number and print(char) should write an ASCII character.
860  Development / Suggestions for the Arduino Project / Re: Is 1.01 pinMode an improvement? on: July 26, 2012, 02:36:18 pm
Coding Badly,

After your vote and some thought I decided to implement 1.01 INPUT and INPUT_PULLUP modes.

Now OUTPUT mode bothers me slightly.  Too bad the Arduino group didn't set the pin level for OUTPUT mode with something like this:

OUTPUT - put the pin in output mode and set its level low.

OUTPUT_HIGH - put the pin in output mode and set its level high.

Then pinMode() would put the pin in a definite state for both input and output mode.
861  Development / Suggestions for the Arduino Project / Is 1.01 pinMode an improvement? on: July 26, 2012, 09:28:59 am
In version 1.0 pinMode(pin, mode) only set/cleared the Port Data Direction Register (DDR) bit.  1.0 does not change the Port Data Register (PORT).

In 1.01 pinMode(pin, mode) has three options for mode:

INPUT - clears DDR bit and clears PORT bit. (pullup disabled)

INPUT_PULLUP - clears DDR bit and sets PORT bit. (pullup enabled)

Else - sets DDR bit but does not change PORT bit.

Is this a better option than 1.0?  It does impact some programs like software I2C where the SDA pin is used for both input and output.

I am about to release a new version of my fast digital I/O library and need to decide whether to follow 1.01.

1.0 is more flexible since you can put a port in input mode without changing the PORT bit or enable/disable the pullup with digitalWrite().

Why not do something similar with output mode by having modes of OUTPUT_LOW and OUTPUT_HIGH?    There are six options - input or output with PORT unchanged, PORT set, or PORT clear.

Simplicity makes me want pinMode() to work like 1.0 but compatibility implies 1.01.
862  Development / Suggestions for the Arduino Project / Re: Benevolent dictator or democracy? on: July 25, 2012, 06:35:35 pm

Your right, I bet they will make millis() different on ARM.

Making millis() subtly incompatible between AVR and ARM seems like something that could/will happen in the Arduino group.  Don't change the name since that would make it easy to know they are different.

I use Cortex processors a lot and don't know why SysTick would forces any change in the way millis() works.  SysTick has a reload register that can contain any value.

It is common for SysTick to be setup to provide a true 1 ms clock on RTOSs. 

I assume that AVR Arduino has the 1024 us tick so both PWM channels on timer0 can be used. 
863  Development / Suggestions for the Arduino Project / Re: Benevolent dictator or democracy? on: July 25, 2012, 04:07:05 pm
Sorry I asked.  I knew better but forgot that Arduino is a little version of Microsoft with much worse support.

I started this topic because of what I found when trying to help a beginner.  I thought beginners deserved better support.

Many of the things that bother me will never change.  For example millis() ticks every 1024 us, sometimes by two ticks to catchup.

pico is right, get on with it.  If you don't like it write your own.
864  Development / Suggestions for the Arduino Project / Re: Benevolent dictator or democracy? on: July 25, 2012, 09:49:52 am
I really like Constantin's analysis of the situation.

After more thought, I think a first step to democracy should be to "Petition the King" for the freedom to setup groups like Constantin described.

For a petition to be effective, you need support from people that matter to the King. 

In the case of the Magna Carta it was feudal barons, not little people.

I am not sure who the equivalent of barons are for Arduino, maybe Arduino vendors and people like Paul Stoffregen with products like Teensy.

Any suggestions on how to ask the King for freedom?
865  Using Arduino / Storage / Re: undocumented classes Sd2Card, SdVolume and SdFile on: July 25, 2012, 07:49:07 am
The Arduino group doesn't really want you to use these classes.  That's why they developed the SD.h wrapper.

If you want to use these classes you should probably use SdFat directly.  There is Doxygen html documentation for these classes with the SdFat library here
866  Development / Suggestions for the Arduino Project / Re: Benevolent dictator or democracy? on: July 25, 2012, 07:43:17 am
BSD Unix is a possible model.  I was at UC Berkley in a computer science research group when BSD evolved.

Ken Thompson and Dennis Ritchie developed Unix at AT&T's Bell Laboratories in the early 1970s.  In January 1974 Professor Bob Fabry obtained a Version 4 tape and it was installed on a PDP-11/45 at UC Berkeley.

AT&T corporation  saw that Unix was successful  and dealing with them became more difficult.  

A number of extensions, fixes, and improvements were developed by users of Unix.  Bill Joy collected these and released a tape called first Berkeley Software Distribution (1BSD).  This was an add-on to Sixth Edition Unix from AT&T.

This process of support evolved until DARPA provided funding to make 4BSD a free open source OS for computer science research.

Development of BSD Unix was guided by an amazing committee:
To guide the design of 4.2BSD DARPA formed a"steering committee" consisting of Bob Fabry, Bill Joy and Sam Leffler from UCB, Alan Nemeth and Rob Gurwitz from BBN, Dennis Ritchie from Bell Labs, Keith Lantz from Stanford, Rick Rashid from Carnegie-Mellon, Bert Halstead from MIT, Dan Lynch from ISI, and Gerald J. Popek of UCLA. The committee met from April 1981 to June 1983.

User support from the Arduino group is non-existent.  A first step could be to collect fixes and improvements in a well known place.  

This would be along the lines of what Paul Stoffregen is doing, not forking the project.

Some open structure needs to be setup to screen and organize submissions so users can easily find and install what they need.

Another step could be a discussion space as pico mentioned where the main topic is how to organize an open user support group.

FreeBSD evolved from the UC work.  This is a key statement about the organization of FreeBSD:
The FreeBSD Core Team constitutes the project's "Board of Directors", responsible for deciding the project's overall goals and direction as well as managing specific areas of the FreeBSD project landscape. The Core Team is elected by the active developers in the project.

So to have a say, vote, you must contribute.
867  Development / Suggestions for the Arduino Project / Benevolent dictator or democracy? on: July 24, 2012, 05:36:28 pm
Why is the Arduino group organized as a benevolent dictatorship and not in a more open democratic way like Debian

The current organization seems to lead to many foul-ups like this,115552.msg869572.htm where Paul Stoffhegan submitted a fix to a serious bug but the fix was not properly handled.

Many of us waste a lot of time because of mysterious events like this.

A more open organization with elections for leaders and a technical board might provide better support for Arduino users.

Even more important, this would provide a better path for development of new features in future releases.
868  Using Arduino / Storage / Re: Data Logger SD, String stops earlier than expected on: July 23, 2012, 06:19:13 pm
Gasp!  The problem appears to be in free(),115552.msg869983.html#msg869983.
869  Development / Suggestions for the Arduino Project / Re: String corrupts the heap and crashes on: July 23, 2012, 06:16:39 pm
Now you see why malloc/heap is not used in serious embedded projects.  This sort of thing happens over and over.

I agree with Graynomad, one could consider allocation of memory at start-up as in the JSF standard.

I never use dynamic memory in my libraries or applications but waste lots of time chasing bugs that are reported in my software that turnout to be due to dynamic memory.

In the future I simply won't look for bugs if an application uses dynamic memory.  Well, maybe I will look for obvious stuff.

This was good for a laugh, failure of free, wow. 

I have more respect for the decision of the real embedded system pros when they forbid use of dynamic memory in standards for critical systems.
870  Development / Suggestions for the Arduino Project / Re: String corrupts the heap and crashes on: July 23, 2012, 03:44:35 pm
In my opinion shot-in-dark things like allocate 10 or 20 extra bytes are the wrong way to fix bugs like this.

You then stand the chance of making it sill happen but less often.

There are lots of cases where this type of fix was used in safety critical systems with horrible outcome.  Then you trust the system because it seems to work but the bug is still there.

Paul usually tries to get the Arduino group to accept his fixes.  I hope the Arduino group would apply a fix if Paul submitted it.

Pages: 1 ... 56 57 [58] 59 60 ... 99