|
Post by brainbomber on Apr 1, 2021 21:00:25 GMT
I have multiple TC375 ShieldBuddies, and everything I've tested on them so far works, except the Arduino attachInterrupt() function. I know it's not my code, because I also ran example code given here (AttachInt.ino), and I know it's not a problem with my readout of the variable being incremented by the interrupt function, making it look like there's an issue when there isn't, because I tried serial prints and usage of the incremented variable to flash an LED. This holds true across pins 2, 3, 15, 18, 20, and 52. I also know it is not a problem with the pins themselves, because I can accurately detect changes on them by defining them as inputs and polling them in the loops. I've also tried compiling/uploading from 2 different Windows 10 64-bit Enterprise computers. Please help. I'm using Arduino Version: 1.8.13; Toolchain Version: 4.9.3.0-infineon-1.0; Whatever version of the ShieldBuddy IDE is currently hosted at www.hitex.co.uk/fileadmin/uk-files/downloads/ShieldBuddy/ShieldBuddyTC375IDE.zip. Thanks so much. *Update:* I've now determined that ISRs triggered by the general purpose timers based on the ATOMs in the GTM also do not work. The code below should cause c to increment every millisecond, but every time c is written to the Arduino serial monitor window it comes up as 0. The same code works fine when the ISR is linked to any of the individual core's timers with the createTimerInterrupt() function. Is the attachInterrupt() function linked to the GTM, thereby making some issue with the GTM, or programming the GTM, my core problem? Both of my boards were bought from the same company within a week of each other, thereby making a bad batch of Shield Buddies a possibility? Or maybe a new release of one of the 3 computer programs the Shield Buddy relies on for uploading/compiling is causing the issue? Please let me know, thanks. StartOfInitialised_DAMRam_Variables volatile unsigned long c = 0; EndOfInitialised_DAMRam_Variables void ISR(int i){ c++; } void setup() { TimerChannelConfig[0].user_inthandler = ISR; InitialiseTimerChannel(0); SetTimerChannelPeriod(0,50000); } void loop() {} void setup1() { SerialASC.begin(9600); } void loop1() { delay(1000); SerialASC.print(c); SerialASC.print("\n"); } void setup2(){} void loop2(){}
|
|
|
Post by brainbomber on Apr 12, 2021 18:51:58 GMT
Could an Admin please help me out with this? I would very much like to get my project working so I can publish it in a neuroscience methods journal. Your help will allow me to expose a community that relies heavily on Arduinos to your product.
|
|
|
Post by Admin on Apr 13, 2021 12:41:40 GMT
We will check this!
|
|
|
Post by Admin on Apr 13, 2021 12:56:02 GMT
Yes there is a problem with the attachInterrupt(). We will issue a fix later today.
|
|
|
Post by Admin on Apr 13, 2021 14:46:03 GMT
|
|
|
Post by brainbomber on Apr 17, 2021 1:04:44 GMT
Thank you so much! I'll let you know how it goes as soon as I have a chance to retest!
|
|
|
Post by brainbomber on Apr 17, 2021 23:58:01 GMT
It still isn't working. When I downloaded the new add-in from the link you posted above, it said it was v1.90Beta, not v1.91 like you said it should be. Please advise.
|
|
uli
New Member
Posts: 7
|
Post by uli on Apr 20, 2021 13:59:04 GMT
The function attachInterrupt() cause a access violation trap on TC375 boards. The reason ist that it tries to write into SCU_EICRx control register which is safety-endinit protected on TC375. Infineon changed some access rights for SFRs from TC275 to TC375 MCU derivative. It seems that the attachInterrupt() function has never been tested on an TC375 ShieldBuddy.
Workaround: Disable the safety-endinit flag temporarily during execution of attachInterrupt() function. This is tricky because the safety-endinit mechanism use a hardware timeout feature and no interrupts should prolong the critical code section with safety-endinit disabled. sample code:
... uint16 u16_Password;
// disable interrupts noInterrupts(); // get last SCU_SEICON0 access password u16_Password = IfxScuWdt_getGlobalSafetyEndinitPassword(); // disable safety-endinit IfxScuWdt_clearGlobalSafetyEndinit(u16_Password);
// now you can call attachInterrupt() attachInterrupt(... use your parameters ...);
// set safety-endinit again IfxScuWdt_setGlobalSafetyEndinit(u16_Password); // enable interrupts again // note: this migth cause problems when interrupts have not been enabled before this code sequence interrupts();
|
|
|
Post by Admin on Apr 20, 2021 14:03:34 GMT
|
|
uli
New Member
Posts: 7
|
Post by uli on Apr 20, 2021 14:12:00 GMT
Ok, thanks a lot!
|
|
uli
New Member
Posts: 7
|
Post by uli on Apr 20, 2021 17:11:01 GMT
Testet the latest version v1.91 (installer shows v1.90beta). The problem with function attachInterrupt() still exist.
|
|
|
Post by brainbomber on Apr 20, 2021 21:57:17 GMT
Thanks, uli, that was very helpful!
I'm also still seeing v1.90beta when I install the "new version" of the add-in, and attachInterrupt() still isn't working. I think the admins have not uploaded the correct file to the download site. They need to fix this.
|
|
|
Post by Admin on Apr 21, 2021 6:59:58 GMT
This sketch works with v1.91. It sounds like something has gone wrong with the add-in download if it is still reporting v1.90. We will check our FTP server.
|
|
|
Post by Admin on Apr 21, 2021 7:00:13 GMT
This sketch works with v1.91. It sounds like something has gone wrong with the add-in download if it is still reporting v1.90. We will check our FTP server.
/*** Don't worry, the normal Arduino setup() and loop() are below this block! ***/
/* LMU uninitialised data */ StartOfUninitialised_DAMRam_Variables /* Put your DAM RAM fast access variables that have no initial values here e.g. uint32 DAM_var; */ EndOfUninitialised_DAMRam_Variables
/* LMU uninitialised data */ StartOfInitialised_DAMRam_Variables /* Put your DAM RAM fast access variables that have an initial value here e.g. uint32 DAM_var_init = 1; */ EndOfInitialised_DAMRam_Variables
/* If you do not care where variables end up, declare them here! */
volatile uint8 Port00_Sample = 0; uint32 volatile PinIntFunc2_var = 0; uint32 volatile PinIntFunc3_var = 0;
void ReadPort00(void); void PinIntFunc2(void); void PinIntFunc3(void);
/*** Core 0 ***/
void setup() { // put your setup code for core 0 here, to run once:
/* Call a function every 100us */ CreateTimerInterrupt(ContinuousTimerInterrupt, 10000, ReadPort00);
/* Any change on Pin D15 will call the PinIntFunc2 function */ attachInterrupt(digitalPinToInterrupt(15), PinIntFunc2, CHANGE);
/* Any change on Pin D18 will call the PinIntFunc2 function */ attachInterrupt(digitalPinToInterrupt(18), PinIntFunc3, CHANGE);
SerialASC.begin(9600);
SerialASC.println("Attach Interrupt Test"); }
void loop() { // put your main code for core 0 here, to run repeatedly:
SerialASC.print("Pin15 Edge Count:"); SerialASC.println(PinIntFunc2_var); SerialASC.print("Pin18 Edge Count:"); SerialASC.println(PinIntFunc3_var); delay(500);
SerialASC.println(" ");
}
/* Entered when pin D15 changes state */ void PinIntFunc2(void) {
PinIntFunc2_var++;
}
/* Entered when pin D18 changes state */ void PinIntFunc3(void) {
PinIntFunc3_var++;
}
/* Entered every 100us */ void ReadPort00(void) {
/* Read directly Port00 bit 0 to 7. This is J406 PIN25 to PIN39 */ Port00_Sample = (uint8)P00_IN.U;
}
/*** Core 1 ***/
/* CPU1 Uninitialised Data */ StartOfUninitialised_CPU1_Variables /* Put your CPU1 fast access variables that have no initial values here e.g. uint32 CPU1_var; */ EndOfUninitialised_CPU1_Variables
/* CPU1 Initialised Data */ StartOfInitialised_CPU1_Variables /* Put your CPU1 fast access variables that have an initial value here e.g. uint32 CPU1_var_init = 1; */ EndOfInitialised_CPU1_Variables
void setup1() { // put your setup code for core 1 here, to run once:
}
void loop1() { // put your main code for core 1 here, to run repeatedly:
}
/*** Core 2 ***/
/* CPU2 Uninitialised Data */ StartOfUninitialised_CPU2_Variables /* Put your CPU2 fast access variables that have no initial values here e.g. uint32 CPU2_var; */ EndOfUninitialised_CPU2_Variables
/* CPU2 Initialised Data */ StartOfInitialised_CPU2_Variables /* Put your CPU2 fast access variables that have an initial value here e.g. uint32 CPU2_var_init = 1; */ EndOfInitialised_CPU2_Variables
void setup2() { // put your setup code for core 2 here, to run once:
}
void loop2() { // put your main code for core 2 here, to run repeatedly:
}
|
|
|
Post by Admin on Apr 21, 2021 8:11:36 GMT
There appears to be a problem with the FTP site as files are not being updated as expected. We are working on a fix...
|
|