- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have this strange behaviour from a TCPWM block: Which is called "TCPWM_Trottle_response"
It is configured as:
timer/counter
Interrupt on terminal count
Code that works perfectly well:
CyGlobalIntEnable;
TCPWM_Trottle_response_Start();
Trottle_repsonse_interrupt_StartEx( Trottle_repsonse_interrupt_handler);
Interrupt routine:
CY_ISR(Trottle_repsonse_interrupt_handler)
{
#ifdef __DEBUG
UART_1_UartPutString("ISR Trottle\r\n");
#endif
PinTest_Write(~PinTest_Read());
TCPWM_Trottle_response_ClearInterrupt(TCPWM_Trottle_response_INTR_MASK_TC);
}
Code that does not work:
CyGlobalIntEnable;
TCPWM_Trottle_response_Init();
TCPWM_Trottle_response_Start();
Trottle_repsonse_interrupt_StartEx( Trottle_repsonse_interrupt_handler);
Does the TCPWM_init() function block the interrupt ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Wow, what a cute boy!
I'm a little bit lost where you are now.
So is your first issue solved or still remaining?
But, meantime if you want to catch interrupt(s) of both fall and rise edge of a pin,
you could do something like
Then you can take care of each events in different ISRs,
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tested with following main.c using CY8CKIT-044.
With both good and bad cases including when __DEBUG is defined and not defined
for all 4 cases, the interrupt in my project did not get blocked.
So I would think that TCPWM_Init() does not block the interrupt (at least not always)
At first I thought that you were defining __DEBUG and UART_1_UartPutString() was
called before UART_1_Start(), which I intentionally placed after your initialization,
but my project worked even with this condition.
So there must be some other reason in your project to make TCPWM_Init() block,
probably some setting(s) of TCPWM.
It would be nice if you can upload a sample project which can reproduce your problem.
(schematic)
main.c
=======================
/**
* TCPWM_Init() function test
https://community.cypress.com/thread/45550
*/
#include "project.h"
#include "stdio.h"
// #define __DEBUG
char str[128] ; /* print buffer */
void print(char *str)
{
UART_1_UartPutString(str) ;
}
CY_ISR(Trottle_response_interrupt_handler)
{
#ifdef __DEBUG
UART_1_UartPutString("ISR Trottle\r\n") ;
#endif
PinTest_Write(~PinTest_Read()) ;
TCPWM_Trottle_response_ClearInterrupt(TCPWM_Trottle_response_INTR_MASK_TC) ;
}
int main(void)
{
#if 0 /* case 1 */
CyGlobalIntEnable; /* Enable global interrupts. */
TCPWM_Trottle_response_Start() ;
Trottle_response_interrupt_StartEx( Trottle_response_interrupt_handler) ;
#else
CyGlobalIntEnable; /* Enable global interrupts. */
TCPWM_Trottle_response_Init() ;
TCPWM_Trottle_response_Start() ;
Trottle_response_interrupt_StartEx( Trottle_response_interrupt_handler) ;
#endif
UART_1_Start() ;
sprintf(str, "TCPWM_Init() test (%s %s)\n", __DATE__, __TIME__) ;
print(str) ;
for(;;)
{
/* Place your application code here. */
}
}
=======================
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for your input, I have included the project archive.
To give you some context, I modded my son's kidcar with BLDCs and I am now writing new firmware 😉
I currently also have a new issue 😉
The pedal, power switch and gear stick are on port 5, 5.0, 5.1, 5.2 resp.
I have an interrupt routine:
CY_ISR( Trottle_switch_interrupt_handler )
{
uint8 interruptSources = Pin_SW_Throtlle_foot_ClearInterrupt();
char msg[20] = "";
sprintf(msg, "ISR Trottle Switch %d\r\n", interruptSources);
if( (interruptSources & 0b00000001) == 1){
Trottle_switch_interrupt_ClearPending();
#ifdef __DEBUG
UART_1_UartPutString(msg);
#endif
PinLed_Write(Pin_SW_Throtlle_foot_Read());
}
}
The interrupt gets triggered on both edge of pin 5.0 but also on pin 5.2 which is offcourse not feasible.
Any thoughts ?
Thanks for your consideration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I currently also have a new issue 😉
The pedal, power switch and gear stick are on port 5, 5.0, 5.1, 5.2 resp.I have an interrupt routine:
CY_ISR( Trottle_switch_interrupt_handler )
{
uint8 interruptSources = Pin_SW_Throtlle_foot_ClearInterrupt();
char msg[20] = "";
sprintf(msg, "ISR Trottle Switch %d\r\n", interruptSources);
if( (interruptSources & 0b00000001) == 1){
Trottle_switch_interrupt_ClearPending();
#ifdef __DEBUG
UART_1_UartPutString(msg);
#endif
PinLed_Write(Pin_SW_Throtlle_foot_Read());
}
}
The interrupt gets triggered on both edge of pin 5.0 but also on pin 5.2 which is offcourse not feasible.
This problem is solved by:
Now I can discriminate between the interrupt sources.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Wow, what a cute boy!
I'm a little bit lost where you are now.
So is your first issue solved or still remaining?
But, meantime if you want to catch interrupt(s) of both fall and rise edge of a pin,
you could do something like
Then you can take care of each events in different ISRs,
moto