Show Posts
Pages: 1 [2] 3
16  Products / Arduino Due / Re: timer library for arduino due on: March 11, 2013, 11:59:56 am
Hi Guys!
Try this at home!
Working fine for me - check my documentation inline.
Also SimonCino's link is very helpfult at this point, there is some essential information specially about channels and clocks you don't want to miss. If you really want to understand what is happening:
Any "Refs" in my documentation are pagenumbers from the link above.

//TC_CV address for Clock 1, Channel 1
//Ref: 911
int *TC_CV = (int *)(0x40084050);

void setup() { 
  //configure the Timer

void loop() {
  // put your main code here, to run repeatedly:
  if(*TC_CV > 1000000){
    Serial.println("Timer stopped");

void configureTimer(){
  //remove writeprotection from timer registers so i am allowed to make modifications on them
  //enable the peripheral ID_TC4 - due to power saving terms this is turned off initially
  //define clock, timerclock 1, channel 1, and some fancy stuff i did't understand at all
  TC_Configure(TC1,1,TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | 2);
  //define the frequency. this signal is 50% on 50% off
  uint32_t rc = VARIANT_MCK/128/1000000;

void startTimer(){
  //start Clock 1, Channel 1
  Serial.println("Timer started");

void stopTimer(){
  //stop Clock 1, Channel 1

What is happening?
Open your serial monitor. You will notice TC_CV counting up to 100000. Then counting stops for few secs - then TC_CV counting up again.
What is happening behind?
In setup the timer is defined and started. In loop is checked if the timer has already reached 100000. If so - he is stopped and execution pauses for 5secs. Afterwards the timer starts again.
Some interesting facts:
There is no reason(can't imagine one) to check a TC_CV register in loop like in this example - this is very bad practice! There are timer interrupts which come in handy...
The numbers you will see will differ more than one, the first number is not 0, the last is not 99999: The timer runs parallel to serial printing and loop(). And these two are very slow compared to the timer.

If someone finds out more about the waveform-magic (TC_CMR_WAVSEL_UP_RC, TC_SetRA) plz let us know!
Hope this helped! Have fun arduinoing!
17  Products / Arduino Due / Re: Atmel Studio With Arduino Due on: March 07, 2013, 09:53:45 am
How did you setup your project?
I am trying to set up a compiling project for two days now - without success.
First i tried the "Arduino Due/X - ATSAM3X8E" C/C++ template delivered with Atmel Studio. This creates a main.c and in the project properties only the c compiler is listed. I'd like to use the Arduino-library. Therefore i need a C++ compiler (right?). Any suggestions how to get him in there? Do you know what the template configueres?
---Didn't get the C++ compiler in smiley-sad so i tried setting up a custom project

I started with the "GCC C++ Executable Project" Template and choose the ATMSAMX38E as device. Now i see the C++ compiler in the project properties. He got some additional informations:
- the directories /variants/arduino_due_x, /system/libsam, and /sam/cores
- the symbols ARDUINO=152, and F_CPU=84000000
- the linker to the libcore.a - compiled for the Programming Port Arduino Due
- i copy pasted the content of the Arduino-Software compiled .cpp into the main.cpp
---> and end up with 5 errors: "use of enum 'adc_resolution_t' without previous declaration", "use of enum 'adc_channel_num_t' without previous declaration" adc.h.
So i visited adc.h and found a lof of lines like: "#if SAM3S_SERIES || SAM4_SERIES || ...." followed by definitions of the variables described in the errors. Could it be that i need to tell my code somewhere else that i use a SAM3X8E?

I got quite stuck here. Does anyone else have similar problems?
Thank you for your help!
18  Products / Arduino Due / Re: Timer Interrupts on Due on: March 06, 2013, 02:05:21 pm
I read trough this thread and find it very very helpful!
At the moment i am trying to measure times between signal-flanks. Therefore i need to stop the time between two (external)interrupts. I'd like to do this with a timer - but don't need the timer interrupt.
As far as i can see the actual time is hold in the TC_CV register. How do i get this value?
I saw you make a lot of use of functions like pmc_set_write_protect and others. Where do you get the documentation of these functions from? And why do you know they even exist? smiley
Thanks a lot!
19  Products / Arduino Due / Re: High frequency measurement using Arduino Due on: March 06, 2013, 07:53:22 am
I'm struggeling with a similar problem.
I took the approach of measuring the time between two interrupts.
Now it turns out that micros() delivers (randomly) wrong values when called in an interrupt-function.
Referring to this thread,148161.0.html
My new idea is to stop times directly with internal timers. But this turns out a bit more difficult than expected  smiley-confuse.
20  Products / Arduino Due / Re: driver installation error on: March 06, 2013, 07:37:58 am
Welcome on board!
Make sure you go trough these instructions:
Go through ALL of these - it will save you time (and perhaps money), trust me! It's worth the 30 minutes!
21  Products / Arduino Due / Re: DUE problem with micros() inside interrupts on: March 05, 2013, 08:40:09 am
Same here...
I am reading the time between two interrupts - and print the measured values. Also figuered out that printing is not the problem here - proved this by changing ports and measuring these with an oszi. I assume that the value of micros() differs exact 1000micS plus or minus the values they are meant to be - perhaps interesting for debugging.
Let us now when sby finds out more!
22  Using Arduino / General Electronics / Re: Anyone make their own circuit boards? on: February 13, 2012, 11:28:25 am
Hi Alligator,
i made horrible experiences with the toner-transfer method. I tried different laserprinters, papers - i invested a lot of time in figuering out how to iron correctly, got it once, but another try failed again. Very very annoying!
I recommend everybody the faster, more professional photoresist alternative. The human error is less and its cheaper (about 30€) in my opinion. You only have to try photoexposure once.  I etch with hydrogene peroxide and salt acid, its very fast, but you have to do it outside because of toxic gases.
Take boards from "Bungard" - this is important, they are very easy to handle!
If you are interested in more info, just write me again - i'll post the whole process then.
good luck!

I attached pic's - the black one is tonertransfer(look at the holes  smiley-mad )
the nice one is photoresist. Both are 5cm * 16cm. Care the "WS11/12" - this is gonna be hard with toner transfer  smiley-razz (excuse poor pics quality)

pictures added
23  Using Arduino / General Electronics / Re: Difference between external Power source and Arduino - *~.'Magic*~°^-, on: February 13, 2012, 11:04:01 am
Thank you guys!
I'll check this out!
24  Using Arduino / General Electronics / Difference between external Power source and Arduino - *~.'Magic*~°^-, on: February 09, 2012, 07:31:32 am
Hi Tinkers!
I am facing an interesting problem with an external Powersource.
The basic setup:
Arduino controls up to 9(3 + 3 + 3) Tlc5940 in row - each fully equipped with leds.

I did a very simple animation - just light up each led alone with a little time difference.
This works very well if the Tlcs and the Arduino are powered via USB.

Now the magic:
To light up more Leds (more powerconsumption) i bought an external powersource, with 5V and 12V output.
I power the Arduino with 12V and my Tlcs with 5V. If i run the same sketch described before with external power, the leds on the Tlc's later in the row are blinking unregularely, noisily. The ones on the first few Tlcs are doing everything as expected. The noise is getting worse the later the Tlc in the row.

I assume:
Is this an effect of power decoupling? I didn't decouple anything - but why it works with USB power then?
I noticed the arduino has some decoupling itselves In step 2. / 3rd Picture 2 C's à 10uF are installed. Do they do the job on the Arduino? I also assume that my USB has a very stable power source - i guess there is maybe no need to decouple.
Do i have to shield the PowerSource? I could imagine that the coils on the powersupply (it is openframe) are influencing the pwm on the bus between the Tlcs. I don't have an oscilloscope so i can't tell exactly which kind of signal loss i am facing with. I'am using shielded cables...but my circuits are unshielded...

Just fyi...i bought the PSA 25L-201;ACTION=7;LA=3;OPEN=0;INDEX=0;FILENAME=D400%252Fpsa25l.pdf;SID=29TSuWG38AAAIAAGvTfmM33d7834abf011b4e206157f613d43d8a

I am very exited about your suggestions and ideas!

25  Using Arduino / LEDs and Multiplexing / Re: TLC5940 + high current + keep the constant current sink (looking for part) on: December 14, 2011, 03:32:15 pm
So just to learn something...
this one fits too:
It is npn so the values of the pwm will react the other way round...
26  Using Arduino / LEDs and Multiplexing / Re: TLC5940 + high current + keep the constant current sink (looking for part) on: December 14, 2011, 08:21:08 am
Just for my basic understanding of reading a Mosfet's datasheet:
Rds(on) is the Resistance between Drain and Source when i connect the given "@" voltage.
Now according to Figure 12 of i know where i made the mistake:
I always thought the Mosfet becomes conductive when i have the right voltage difference between source and gate. But obviously things are not that easy smiley-wink
The problem is that the resistance gets very high when the Voltage difference between source and drain is too low! *lightbulb* So Vds(on) significantly influences the resistance of the Mosfet.

Are there more tripping hazards like this?

27  Using Arduino / LEDs and Multiplexing / Re: TLC5940 + high current + keep the constant current sink (looking for part) on: December 13, 2011, 07:26:22 pm
Finally we found one (yeah i really hope 4 eyes got the right one now)
Did you mean Ugs(on)/Vgs(on) here?
Look for one that has Rgs(on) specified at 4v or 4.5v.
28  Using Arduino / Project Guidance / Re: Timer on: December 11, 2011, 09:15:34 pm
Shouldn't the second if not be:
if (LedState == 1 and millis() - StartTime > 5000)
Two == ...
29  Using Arduino / LEDs and Multiplexing / Re: TLC5940 + high current + keep the constant current sink (looking for part) on: December 11, 2011, 09:04:18 pm
Ok...weekend is over(i need weekend) - now i have to do PROGRESS smiley
I just made some decisions with my collegue who works with me on this project.
First of all i'd like to thank you two very much for your support!
We will do the "small version" with normal leds - we will face some other problems when it comes to etching for sure, so time is an expensive factor.
We will build it modular - so we can extend the actual controllerboard with a "driverboard" which contains the small solution of powering the 3W led by MOSFET and resistor.
The circuit design must be Pin (2.54) compatible. We can use our parts even if etching fails (which is quite hard when we work with smd).
And there is another question (yeah im not annoying smiley-wink ):
The posted MOSFET is smd - due to our decision it won't make it to the basket. I found another one which seems to be similar for me - one thing i noticed: the GS threshold voltage is -2 to -4 on the recommended RTR030P02 (second link, previous post) it is -0.7 to -2. Will this work out with my -5V? I read that the on resistance is 0.32 ohm - do i need to subtract the volts i lose in the mosfet?
In the attachment i painted how i'd wire it. Please ignore the calculation - the correct one is: ((5V - 0.32ohm*350mA)-Urgb)/350mA = Rrgb
Thanks a lot!!!
30  Using Arduino / LEDs and Multiplexing / Re: TLC5940 + high current + keep the constant current sink (looking for part) on: December 11, 2011, 02:44:10 pm
Ok...slowly i understand the circuit...and your calculation.
Due to evp's advice i will have to switch the led!!!
Just because of the price - the shop sells it for 2,14€ vs. 10€ this saves me so much money! - and this comes in handy with our problem (when i got everything right).
If i switch to this one i'll deal with 3.6 max v loss. So just to be sure i understood this correctly i have 5 - 3.6 - 0.65= 0.75 V Vsat. To get the red one up to the same V i burn 1V with a 2.8 Ohm resistor. The friction in the transistor is reduced to 262mW.
So lets give me another try with a part smiley-wink
Vsat is -500mV (i can provide 750 in the worst case), Powerdissipation can be over 1W (i am below with 262mW) Did i forget something?

Just to ask it: is it really that bad to drive an led via resistor without ccs??? I can't imagine how those are driven... (they get special drivers i guess as dc42 mentioned in his first post).
Pages: 1 [2] 3