Loading...
  Show Posts
Pages: [1] 2 3 ... 5
1  Products / Arduino Due / Re: [gitHub] Thread and ThreadController classes for Arduino on: May 16, 2013, 01:32:07 am
I have done lots of testing on it, and it's really robust.

I'm using it in my robot ( tendadigital.net/tag/robocup/), and implemented a nice CPU usage calculation, since we use MANY sensors Threads and knowing it is very nice...
2  Products / Arduino Due / Simple way to convert from Floating point to String on: May 13, 2013, 08:23:47 pm
Well, I searched for some time on the Internet for an reliable way to convert from a floating point to String, but I found none in 10 secconds and did my self that.

If you need, this is the code (Also explained a bit):

Code:
String floatToString(float f, int decimals = 2){
/*
Transforms the floating point string process:
eg.: using decimals = 2, input: 1.23456
1.23456 * (pow(10, 2+1)
1.23456 * 1000 = 1234 (as a long)
now, let's move digits asside:
3 goes to 4, 2 goes to 3.
Stages: "1234"
"1233"
"1223"
Not, put a dot in the place of the separator
"1.23"

*/
long fLong = f*(pow(10,decimals+1));
String longString = String(fLong);
int len = longString.length();

for(int i = 0; i < decimals; i++){
longString[len - 1 - i] = longString[len - 2 - i];
}
longString[len - decimals - 1] = '.';

return longString;
}
3  Products / Arduino Due / INSTRUCTIONS to skip verification on: May 12, 2013, 12:48:45 am
Hi,
I was getting furious, because my sketch already had 140kb, and was taking about 1 minute to upload.

Then, I figure out how to "skip" verification (The second "stage" of upload).

To disable verification, go to:
ArduinoSoftwareFolder/hardware/arduino/sam/plataform.txt

Then, open it and go to the last line (It's what "calls" bossac to upload the sketch). Find the following section:
"-e -w -v -b"
and alter it to:
"-e -w -b" (just remove the "-v", witch means: VERIFY code after upload).

After all, it should be like this:
tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -e -w -b "{build.path}/{build.project_name}.bin" -R

Save the file, close and open Arduino IDE. Select another plataform and select Arduino Due Programming port just to make shure.

Have fun.
4  Products / Arduino Due / [gitHub] THREAD and THREADController classes for Arduino on: May 11, 2013, 01:39:57 am
Hi,
I always use this library for myself, and I personaly think that is VERY usefull. Its clear that Arduino doesen't support real parallel processes, but we can "sort" of do it with scheduled tasks.

Yes, there is already an class called "Scheduller", but for big projects (likes the ones I do, with more than 15.000 lines), it's not "good" enought...

I LOVE Object Oriented stuff, and this follows it pretty much.

Check out the library here: https://github.com/ivanseidel/ArduinoThread

It also works for ANY arduino, but I implemented thinking on the DUE, since it's capable of more stuff (I use it with my ArduinOS, and it's just perfect =] )

Any suggestions are welcome!
5  Development / Other Software Development / [gitHub] Thread and ThreadController classes for Arduino on: May 11, 2013, 01:27:28 am
Hi,
I always use this library for myself, and I personaly think that is VERY usefull. Its clear that Arduino doesen't support real parallel processes, but we can "sort" of do it with scheduled tasks.

Yes, there is already an class called "Scheduller", but for big projects (likes the ones I do, with more than 15.000 lines), it's not "good" enought...

I LOVE Object Oriented stuff, and this follows it pretty much.

Check out the library here: https://github.com/ivanseidel/ArduinoThread

Any suggestions are welcome!
6  Products / Arduino Due / Re: Timer Interrupts on Due on: May 07, 2013, 01:28:34 pm
Try using my Library: https://github.com/ivanseidel/DueTimer
It has everything implemented, revised, and checked... (It's not PERFECT, but if you find any bugs, fell free to notify me!)
7  Products / Arduino Due / Re: Do Arduino Due' timers give us only low frequencies?! on: April 30, 2013, 09:30:49 pm
Nice!

Tell us if it worked or not...
8  Products / Arduino Due / Re: Servo library + timer library? on: April 30, 2013, 05:57:49 pm
Can you detail the problem? I mean, what happens when you create both Servo and Timer? No one works, the last one works...

And also, have you tried using others timers (0,1,2,3,4,5,6,7,8)?

Did you used my library? github.com/ivanseidel/DueTimer

Ivan
9  Products / Arduino Due / Re: Do Arduino Due' timers give us only low frequencies?! on: April 30, 2013, 12:30:34 pm
Did you installed correcly the library? http://arduino.cc/en/Guide/Libraries

(Just add the unziped folder downloaded from gitHub, to your library folder (on your sketch folder, or, on the arduino software folder).

Note, that to the library be recognized, YOU MUST restart Arduino software smiley-wink

Ivan
10  Products / Arduino Due / Re: Do Arduino Due' timers give us only low frequencies?! on: April 30, 2013, 12:22:38 pm
Hi,
Try using my library: github.com/ivanseidel/DueTimer

It has an implementation to choose the BEST timer division, for every frequency...

Notify me if worked! (or not worked =])

Ivan
11  Products / Arduino Due / HIDDEN Analog PINS (52, 20 and 21) on: April 27, 2013, 12:39:50 pm
Hello!
This days I was looking at the SAM3X datasheet and notice one WEIRD thing: It said that arduino has 15 Analog ready pins, but when I read the Arduino Due page, there was only 12 listed as Analog...

This is what intrigued me to find a solution to enable the others 3 pins, since my project needed 13 (yes, one more than the available).

The pins, not marked as analog that Could "become" one is 52, 20 and 21.

Maybe Arduino guys did that to maintain the same "pattern" as the old arduinos, but, why not let it enabled? It only changes a few lines of code (to be exact, 6 lines).

I will create a new commit of the arduino in my github repository if any one wants..
12  Products / Arduino Due / Re: Timer Interrupts on Due on: April 20, 2013, 03:12:08 pm
Using this code, you can set a timer for any of the ISRs TC0_Handler through TC8_Handler, see table of parameters below. It is possible to use the timers without a physically mapped pin, such as TC1 channel 0 (TC3_Handler) shown here:

Code:
volatile boolean l;

//TC1 ch 0
void TC3_Handler()
{
        TC_GetStatus(TC1, 0);
        digitalWrite(13, l = !l);
}

void startTimer(Tc *tc, uint32_t channel, IRQn_Type irq, uint32_t frequency) {
        pmc_set_writeprotect(false);
        pmc_enable_periph_clk((uint32_t)irq);
        TC_Configure(tc, channel, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK4);
        uint32_t rc = VARIANT_MCK/128/frequency; //128 because we selected TIMER_CLOCK4 above
        TC_SetRA(tc, channel, rc/2); //50% high, 50% low
        TC_SetRC(tc, channel, rc);
        TC_Start(tc, channel);
        tc->TC_CHANNEL[channel].TC_IER=TC_IER_CPCS;
        tc->TC_CHANNEL[channel].TC_IDR=~TC_IER_CPCS;
        NVIC_EnableIRQ(irq);
}

void setup(){
        pinMode(13,OUTPUT);
        startTimer(TC1, 0, TC3_IRQn, 4); //TC1 channel 0, the IRQ for that channel and the desired frequency
}

void loop(){
}

Here is the table of parameters:
ISR/IRQTC        ChannelDue pins
TC0TC002, 13
TC1TC0160, 61
TC2TC0258
TC3TC10none  <- this line in the example above
TC4TC11none
TC5TC12none
TC6TC204, 5
TC7TC213, 10
TC8TC2211, 12

Noob question here, could someone please explain the inputs to the startTimer function? What is channel, and how do we use the frequency input?  Also, what are the pins in the table for?


Can anyone kindly answer to the following question please?
How can we disable the Timer by turning off the PWM? (Outside of Timer Function)



Hi,

If it's really needed to understand the code, i suggest you looking at the Datasheet, that is the best place to get those explanations since every uController is different.

But, if you just want to use timers on arduino Due, install the DueTimer library: github.com/ivanseidel/DueTimer

Regards,
Ivan
13  Products / Arduino Due / Re: Timer Interrupts on Due on: April 15, 2013, 11:10:21 am
Thanks guys for this mission. I got 1 MHz working on the DUE, but I found that digitalWrite is slow. So it messes up my tc_handler. Doesn't leave it anymore. And I need to write in the ISR, maximum control every microsecond. You have a fast alternative for digitalWrite ?

after configuring the pin, you can easily do as it follows:

Output HIGH on PIN 0 of port D:
REG_PIOD_SODR = 0x01; ( equivalent to: 0b0000000000000001);

Output low on PIN 0 of port D:
REG_PIOD_CODR = 0x01; ( equivalent to: 0b0000000000000001);

And, to configure PIN 0 of port D as output pin:
REG_PIOD_OER = 0x01; ( equivalent to: 0b0000000000000001);

Notice, that even digital pins are buffered, so, trying to read this register, will return NULL or some random value...

Also, writing more than one pin on the register will cause NO problem.

Also, to know wich port the pin relates with, read the arduino description, right on top, there is an link to check this...

There is one other easy way of doing this, but i'm without a computer right now...
14  Products / Arduino Due / Re: Timer Interrupts on Due on: April 14, 2013, 12:41:34 pm
Henrimontreal, you are only getting the header - you need all the code which is packaged up as a library and placed within the Arduino IDE Library folder prior to writing your program.  See http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use on libraries and how they are used.  Then you can get the timer library, install it like in the tutorial, then your code will not give such error(s).  Putting the .h file on your desktop is not enough.

Well, this is so strange! Even though, I copy them into the Arduino's Library as well as the same folder on my desktop. I still have the same error!  smiley-eek  I am so frustrated!  smiley-yell

Hi,
I have sent a new commit to GitHub, with a new organization to facilitate installation.
Please, download egain (https://github.com/ivanseidel/DueTimer/archive/master.zip) the files, and install as explained on Arduino site.

Thanks,
Ivan Seidel
15  Products / Arduino Due / Re: Timer Library for Arduino DUE on: April 12, 2013, 12:54:52 am
Hi!
As i like libraries, i have done one for Timers on the Arduino DUE.

You can check it out here: https://github.com/ivanseidel/DueTimer

All 6 timers are fully implemented, and ready to play with...


May I ask you how I can use your file? I cannot include any library from out side. Is there anyway to run within one file? I would like to use a timer and change the REG by Serial Monitor.

Hi,
If you want to include the library to your project, than all you nees to do is to copy DueTimer.h and DueTimer.cpp to your sketch folder and include it normaly (#include "DueTimer.h").
What do you mean by change REG? And might I ask why can't you install the library?
Thanks,
Ivan
Pages: [1] 2 3 ... 5