IDE V1.5.3

This piece of source was running with IDE 1.5.2.
Now with 1.5.3 gives errors like

"error: 'tc' was not declared in this scope"
"error: 'IRQn_Type' was not declared in this scope

Can someone help me to understand way ?

I think I have to #include <something.h>, but I do not know what.

//******************************************************************************************
// Timer call for TC1 Channel 0 (working with V1.5.2 but not with V1.5.3)
//******************************************************************************************
void startTimer(Tc *tc, unsigned long int channel, IRQn_Type irq, unsigned long int 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_CLOCK1);
uint32_t rc = VARIANT_MCK/2/frequency;
TC_SetRA(tc, channel, rc/2);
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);
}

Hello giubio51,
I just did run the following code in IDE 1.5.3 and ran OK. No errors.

#include <Wire.h>
#include <SPI.h>

void startTimer(Tc *tc, unsigned long int channel, IRQn_Type irq, unsigned long int 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_CLOCK1);
  uint32_t rc = VARIANT_MCK/2/frequency;
  TC_SetRA(tc, channel, rc/2);
  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(){
}

void loop(){
}

Regards!

Thanks Palliser !

but still not working.

I am suspecting the IDE can not recognize where is located the Arduino folder.
I have also copied the Wire.h and SPI.h in the same folder of my sketch, but still not working.

In my computer, the Arduino folder is located under c:\program files (c:\programmi in italian).
my sketch worked fine with the V1.5.2
I have installed the V1.5.3 and now I am not more able to use this sketch.
What a hell is happening ?!!
Please remark, I am a real beginner, then any help is welcomed.

Grazie !

giubio51,
It's weird because the IDE 1.5.3 comes with the SPI and Wire libraries.

Please, wherever your IDE 1.5.3 is located, verify that it contains the SPI folder in the following path:

...\arduino-1.5.3-windows\arduino-1.5.3\libraries

And the wire folder in the following path:

...\arduino-1.5.3-windows\arduino-1.5.3\hardware\arduino\sam\libraries\

If so, you don't need to have them somewhere else. Regards!

@giubio51

may you activate the "Verbose compile" from preferences, run the compile again, and copy/paste the error (using the "Copy error" button).

Thanks to everyone !

I have uninstalled the 1.5.3 and I am downloading it again from scratch.

No one file can be compiled, so the problem is more heavy than expected.

After the new installation I will post again the results.

One easy question: have the main folder to remain as Arduino-1.5.3 or it must (or can) be renamed ?

I have in fact renamed it as Arduino (without -1.5.3).

Don't worry about previous folder names. Just download the IDE 1.5.3, unzip it and create a shortcut in your desktop of the Arduino.exe file ( inside ...\arduino-1.5.3-windows\arduino-1.5.3 ).

Fresh installation done.
Still the problem remains.

This is the list of errors:

LabDCC:12: error: variable or field 'startTimer' declared void
LabDCC:12: error: 'Tc' was not declared in this scope
LabDCC:12: error: 'tc' was not declared in this scope
LabDCC:12: error: expected primary-expression before 'unsigned'
LabDCC:12: error: 'IRQn_Type' was not declared in this scope
LabDCC:12: error: expected primary-expression before 'unsigned'
LabDCC:54: error: variable or field 'startTimer' declared void
LabDCC:54: error: 'Tc' was not declared in this scope
LabDCC:54: error: 'tc' was not declared in this scope
LabDCC:54: error: expected primary-expression before 'unsigned'
LabDCC:54: error: 'IRQn_Type' was not declared in this scope
LabDCC:54: error: expected primary-expression before 'unsigned'
LabDCC.ino: In function 'void Pulse(long unsigned int)':
LabDCC:73: error: 'TC1' was not declared in this scope
LabDCC:73: error: 'TC3_IRQn' was not declared in this scope
LabDCC:73: error: 'startTimer' was not declared in this scope
LabDCC.ino: In function 'void setup()':
LabDCC:236: error: 'TC1' was not declared in this scope
LabDCC:236: error: 'TC3_IRQn' was not declared in this scope
LabDCC:236: error: 'startTimer' was not declared in this scope

wow..... :roll_eyes:

The IDE was set for Arduino Uno....

By setting it with Arduino Due the problem has disappeared.

Long way to be a guru ... :astonished:

But you are already Italian! 8)