Pages: [1]   Go Down
Author Topic: Arduino DUE underclock  (Read 1587 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi guys, i'm working with some eeproms and flash parallel memories with my arduino DUE, i started this project with the UNO and now i'm porting it to DUE, hoping to gain speed due to the better clock speed and more pin availability.. now.. it seems to work just fine, but with some memories and, sometimes flashing some files, i can notice some bug or writing error.
i think this is caused by the arduino speed compared to memory access time..
is there a way to underclock or slown down arduino a LITTLE BIT? (i know delay delaymicrosecond... ) i'd really like something like delayNanoseconds, we are working with powerfull processors and in this cases a few nanoseconds make the difference!
i also thought to use the internal 32mhz oscillator for testing... is this possible? how can i do this? thank you!
« Last Edit: November 03, 2012, 04:16:58 am by razer93 » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17262
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i'd really like something like delayNanoseconds, we are working with powerfull processors and in this cases a few nanoseconds make the differents!

I've seen posted at time when there is a need for a shortest possible 'delay' in a AVR sketch to just insert a assembly language NOP statement which gives you a 62.5 nsec delay for each NOP on a standard arduino board. I would assume something similar could be done in a Due sketch.

Lefty

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i'd really like something like delayNanoseconds, we are working with powerfull processors and in this cases a few nanoseconds make the differents!

I've seen posted at time when there is a need for a shortest possible 'delay' in a AVR sketch to just insert a assembly language NOP statement which gives you a 62.5 nsec delay for each NOP on a standard arduino board. I would assume something similar could be done in a Due sketch.

Lefty


first of all thanks,
i think that in the UNO case, 16mhz, the NOP you said skip a clock cycle (1/16m)= 62.5nsecods, so yes... i'm looking for something like that
unfortunately i'm not good in arm or avr assembly.. waiting for a genius smiley
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
asm volatile ("nop \n\t ");  // a NOP

asm volatile (".rept 10\n\t nop \n\t .endr\n\t"); // 10 NOPs - you can change the 10 for anything reasonably small

#define MNOP(x) asm volatile (" .rept " #x "\n\t nop \n\t .endr \n\t")    // A macro I use a lot
MNOP(20); // 20 NOPs

These work on both AVR and ARM.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley-grin thanks!!
Logged

Pages: [1]   Go Up
Jump to: