Pages: [1]   Go Down
Author Topic: Selfmade Due running way to slow  (Read 999 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 3
Posts: 133
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I build my own Due Board (kind of). I programmed it using an J-Link (SWD). My first try was uploading the Blink sketch. When trying to Blink with Output Digital 50, it way to slow! When I set the Sketch to have an Intervall of 1 sec, the Due actually takes 6 sec to do it!

I uploaded the sketch (as I said) using my Segger J-Link and AtmelStudio with the Arduino DUE Project file selected. What could that be? are there any fuses I need to set?
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 145
Posts: 5453
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I build my own Due Board (kind of). I programmed it using an J-Link (SWD). My first try was uploading the Blink sketch. When trying to Blink with Output Digital 50, it way to slow! When I set the Sketch to have an Intervall of 1 sec, the Due actually takes 6 sec to do it!

You probably didn't set the proper CPU clock speed.

are there any fuses I need to set?

Yes.
« Last Edit: May 09, 2013, 01:16:33 pm by fungus » Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

vermont
Offline Offline
Sr. Member
****
Karma: 8
Posts: 313
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

for optiboot with 8mhz internal clk i found h=d6 l=e2 best. for 16mhz crystal i use h=d6 l=a7. these preserve ee on download as opposed to arduino settings which, for some peculiar reason, destroy the ee data every time.
Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 133
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

thanks for the fast response. Im using an 12mhz and 32.xxkhz Crystal. The Sam3x8e doesnt use Optiboot.
Also, I cant find the Fuse settings, the only bits I can set are the GPNVM and Lockbits.
Where do I have to look? Do I need any other external tools?
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 145
Posts: 5453
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

thanks for the fast response. Im using an 12mhz and 32.xxkhz Crystal. The Sam3x8e doesnt use Optiboot.
Also, I cant find the Fuse settings, the only bits I can set are the GPNVM and Lockbits.
Where do I have to look? Do I need any other external tools?

For weird crystals you might have to edit "boards.txt" and create a new entry for your board/crystal (set F_CPU).
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Full Member
***
Karma: 3
Posts: 133
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But the Due also uses an 12mhz fast and 32.768 Slow Crystal  smiley-sad
http://arduino.cc/en/uploads/Main/arduino-Due-schematic.pdf
Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 133
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry for doupleposting, but could anyone look on their Due to tell me which Crystal is installed? I read several Threads where it says there is an 16mhz Crystal, which would explain the whole thing here.
Logged

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

The SAM3X crystal is 12MHz. It doesn't have fuses, instead the clock speed is set by the PLL registers. To get 84MHz you set some register somewhere to multiply the crystal frequency by 7. I don't know any more about it than that though.
Logged


SF Bay Area (USA)
Online Online
Tesla Member
***
Karma: 132
Posts: 6738
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you call Atmel's SystemInit() function from your main() ?
This is called from the Arduino main.c, and appears to setup default system clock behavior.
Normally, I would think that code should call sysclk_init() from the asf library (at least, if you're using asf (which arduino does)), but I don't see that in the arduino startup.
The actual code is in ...hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/source/system_sam3xa.c
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 13
Posts: 257
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry for doupleposting, but could anyone look on their Due to tell me which Crystal is installed? I read several Threads where it says there is an 16mhz Crystal, which would explain the whole thing here.

Hmm, I've built a Due barebones some time ago.. And the blink sketch is working AÒK!! Here is the thread: http://forum.arduino.cc/index.php?topic=152234.0.. I used 12MHz and  32.768kHz crystals...
Logged

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

Hullo tsag . I have been trying to connect board work to the J-Link Segger ......... it detects the board but it does nt do anything else , it says failed to read or write ... and it detects wrong core ID ...... so can u plz tell me how u made it work? .... (I have J-Flash V 4.5 as the software for the J link )
Logged

Pages: [1]   Go Up
Jump to: