Pages: [1]   Go Down
Author Topic: Sanguino + DAC + RTC + Altoids  (Read 1080 times)
0 Members and 1 Guest are viewing this topic.
Boston, MA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1024
wiblocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just finished a prototype for a new board I am
working on -- NB2A which is ATmega644P,
DS1337 RTC and a TLV5618 DAC in an Altoids
form factor.

I used the Arduino+Sanguino setup and my RTC
and DAC libraries to write a couple '644 apps.

The DAC and RTC applications are listed in the
"Applications Hints" section at http://tinyurl.com/ykp9ocd
The sparsely doxygenated documentation is
under the "Libraries" section.

(* jcl *)
Logged


0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool.
I am wondering: do you need to adapt some libraries (those containing Serial, millis etc) for the 12MHz clock?
How much?
Logged

Denver
Offline Offline
God Member
*****
Karma: 20
Posts: 779
Inactive - PM
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Why a 12MHz clock? Did I miss something? I used a 16MHz clock with the Sanguino board I built and it seems to run fine.

Nice board, BTW. The Altoids form factor is a great idea.
Logged

"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll

Boston, MA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1024
wiblocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Cool.
Thanks.

Quote
I am wondering: do you need to adapt some libraries (those containing Serial, millis etc) for the 12MHz clock?How much?

I changed the frequency definition in the Makefile for the bootloader and in the
boards.txt file. No changes are required anywhere else.

All of the Sanguino stuff I tried just worked. Both the Arduino and Sanguino teams
have done a nice job.

(* jcl *)
Logged


Boston, MA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1024
wiblocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Why a 12MHz clock? Did I miss something? I used a 16MHz clock with the Sanguino board I built and it seems to run fine.

I run the board at 3.3V so I use a lower frequency.

Quote
Nice board, BTW. The Altoids form factor is a great idea.

Thanks. I will have pictures of the Li-ion charger that fits underneath shortly.

(* jcl *)
Logged


London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I changed the frequency definition in the Makefile for the bootloader and in the boards.txt file. No changes are required anywhere else.

There is a caveat to that statement - Although libraries usually use the CPU frequency definition to handle frequency dependent code, this does not necessarily mean they will all work at 12mhz. for example, if the code assumes that the cpu clock is evenly divisible by 8 then it can break when running at 12 mhz (the Arduino millis and delay functions had that problem up until recently).  

So although all the Arduino core functions should work, it is possible that some third party code could have a problem with 12mhz.
Logged

Boston, MA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1024
wiblocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So although all the Arduino core functions should work, it is possible that some third party code could have a problem with 12mhz.

Any ideas which libraries to watch out for?

Seems like it should be easy to fix.

(* jcl *)
Logged


London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

One example off the top of my head is NewSoftSerial,  
see: http://arduiniana.org/libraries/NewSoftSerial/

I think it assumes the CPU clock is either 8MHz or 16MHz.
Adding support for 12MHz is probably doable but not trivial.
Logged

Boston, MA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1024
wiblocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
One example off the top of my head is NewSoftSerial,  
see: http://arduiniana.org/libraries/NewSoftSerial/

I think it assumes the CPU clock is either 8MHz or 16MHz.
Adding support for 12MHz is probably doable but not trivial.

Thanks for the input.

I took a quick look at the NewSoftSerial. It doesn't seem like it would be too difficult
to fix (could be famous last words smiley-wink). If I run out of UARTs on the 644P (which could be as early as the next project smiley-wink) I may fix it.

(* jcl *)
Logged


London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You may want to ask the author, Mikal Hart  (username=mikalhart) for advice in tuning the parameters. BTW, in deference to Mikal, it's not broken – his software does what it is documented to do. There has been no need for Arduino software to run at speeds other than 8 and 16 MHz and that's why one shouldn't be surprised if there is code out there that doesn't work at other clock rates.
Logged

Boston, MA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1024
wiblocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
BTW, in deference to Mikal, it's not broken – his software does what it is documented to do.

I didn't mean to imply that the software was defective.

I took a quick look at the NewSoftSerial.
It doesn't seem like it would be too difficult to fix extend.


(* jcl *)
Logged


Pages: [1]   Go Up
Jump to: