- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a problems with the interrupts with psoc5. When i start the interrupts, after a casual time this interrupts are blocked. Can you help me ? it's urgent! Thanks
I have setted the block this:
Resolution: 8-bit
Implemetation.fixed function
Period:100ms
Capture mode:none
Enable mode:Software only
Run mode: Continuos
Interrupts: On TC
I have initialized the interrupts this :
// Start Global Interrupt
CYGlobalIntEnable ;
CyDelay ( TIME_5_MS ) ;
/* Start components Interrupt */
isr_I2C_rd_tmr_StartEx ( isr_I2C_rd_tmr_Interrupt ) ;
// Avvio l'interrupt per leggere l'I2C
isr_I2C_rd_tmr_Start ( ) ; // Start ISR
// ... e il timer per la lettura del i2C
I2C_Reader_Timer_Start ( ) ;
isr_I2C_rd_tmr_Enable ( ) ;
Functions interrupts :
CY_ISR(isr_I2C_rd_tmr_Interrupt)
{
#ifdef isr_I2C_rd_tmr_INTERRUPT_INTERRUPT_CALLBACK
isr_I2C_rd_tmr_Interrupt_InterruptCallback();
#endif /* isr_I2C_rd_tmr_INTERRUPT_INTERRUPT_CALLBACK */
/* Place your Interrupt code here. */
/* `#START isr_I2C_rd_tmr_Interrupt` */
// Leggo lo stato del timer
I2C_Reader_Timer_ReadStatusRegister ( ) ;
// Cancello interrupt pendenti
// isr_I2C_rd_tmr_ClearPending ( ) ;
#ifdef DEBUG_ON
count ++ ;
// Visualizzo il debug solamente una volta
printf ( "T:%i\r\n" , count ) ;
#endif
/* `#END` */
}
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I also tried with CY8CKIT-059, and found that
"isr_I2C_rd_tmr_Interrupt" is defined in the auto generated function in "isr_I2C_rd_tmr.c".
And you were calling both
isr_I2C_rd_tmr_StartEx ( isr_I2C_rd_tmr_Interrupt ) ;
and
isr_I2C_rd_tmr_Start ( ) ; // Start ISR
Which I don't think good idea.
So I created following project to test
schematic
Pins
main.c
==============
#include "project.h"
#include "stdio.h"
volatile uint32_t count = 0 ;
#define STR_LEN 64
char str[STR_LEN+1] ;
void print(char *str)
{
UART_PutString(str) ;
}
void cls(void)
{
print("\033c") ; /* reset */
CyDelay(100) ;
print("\033[2J") ; /* clear screen */
CyDelay(100) ;
}
void splash(void)
{
cls() ;
print("PSoC 5LP Interrupt Test ") ;
snprintf(str, STR_LEN, "(%s %s)\n", __DATE__, __TIME__) ;
print(str) ;
}
CY_ISR(my_I2C_Timer_isr)
{
I2C_Reader_Timer_ReadStatusRegister() ;
count++ ;
}
void init_hardware(void)
{
UART_Start() ;
/* Start components Interrupt */
isr_I2C_rd_tmr_StartEx ( my_I2C_Timer_isr ) ;
I2C_Reader_Timer_Start() ;
CyGlobalIntEnable; /* Enable global interrupts. */
}
int main(void)
{
uint32_t prev_count = 0 ;
init_hardware() ;
splash() ;
for(;;)
{
if (prev_count != count) {
prev_count = count ;
snprintf(str, STR_LEN, "count = %d\n", prev_count) ;
print(str) ;
}
}
}
==============
Tera Tem log
(at start)
(current (while I'm typing this))
So far, working.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
gisc,
I'll make a first attempt to address your question. If my suggestion is not successful, I may ask for a copy of your project to try to reproduce the issue.
I noticed something in the code you included. You have a printf() statement within the Interrupt Service Request (ISR). This is basically not a good idea. The printf() function is potentially a blocking function. This means that to print your debugging information, you may be stuck in the interrupt with all other interrupts blocked until the printf() is completed and you return from the isr_I2C_rd_tmr_Interrupt() ISR.
Since this is a debugging code line, comment it out. Connect an PSoC pin configured as an output on the interrupt line. See pic.
Connect an oscilloscope to the Pin_ISR_mon. You should see a positive pulse every time an ISR is requested. This is a good HW debugging mode to replace your printf() with no performance impact on your running code.
Len
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I also tried with CY8CKIT-059, and found that
"isr_I2C_rd_tmr_Interrupt" is defined in the auto generated function in "isr_I2C_rd_tmr.c".
And you were calling both
isr_I2C_rd_tmr_StartEx ( isr_I2C_rd_tmr_Interrupt ) ;
and
isr_I2C_rd_tmr_Start ( ) ; // Start ISR
Which I don't think good idea.
So I created following project to test
schematic
Pins
main.c
==============
#include "project.h"
#include "stdio.h"
volatile uint32_t count = 0 ;
#define STR_LEN 64
char str[STR_LEN+1] ;
void print(char *str)
{
UART_PutString(str) ;
}
void cls(void)
{
print("\033c") ; /* reset */
CyDelay(100) ;
print("\033[2J") ; /* clear screen */
CyDelay(100) ;
}
void splash(void)
{
cls() ;
print("PSoC 5LP Interrupt Test ") ;
snprintf(str, STR_LEN, "(%s %s)\n", __DATE__, __TIME__) ;
print(str) ;
}
CY_ISR(my_I2C_Timer_isr)
{
I2C_Reader_Timer_ReadStatusRegister() ;
count++ ;
}
void init_hardware(void)
{
UART_Start() ;
/* Start components Interrupt */
isr_I2C_rd_tmr_StartEx ( my_I2C_Timer_isr ) ;
I2C_Reader_Timer_Start() ;
CyGlobalIntEnable; /* Enable global interrupts. */
}
int main(void)
{
uint32_t prev_count = 0 ;
init_hardware() ;
splash() ;
for(;;)
{
if (prev_count != count) {
prev_count = count ;
snprintf(str, STR_LEN, "count = %d\n", prev_count) ;
print(str) ;
}
}
}
==============
Tera Tem log
(at start)
(current (while I'm typing this))
So far, working.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks you , i have resolved the my problem.