- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm using PsoC 4 CY8C4127AZI-S445 and I need an interrupt from an digital input pin.
So far so good. Following picture shows how I created it in the TopDesign:
I'm getting an interrupt unfortunately inverted, it means when an interrupt should be triggered there is no interrupt and there is an interrupt when no interrupt should be triggered.
Changing interrupt setting from pin to falling edge or rising edge doesn't make any difference.
Is it possible to invert the input pin and then trigger the interrupt? If yes how?
Thanks & best regards.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Thomas-san,
This morning I tried again,
and accidentally found that pin interrupt could be level, rising edge, "falling edge", and both edge!
So if you configure the pin's input interrupt as "Falling edge"
The original schematic should work
So I modified the schematic as below to test with my board which has CY8C4146LQI-S433
As I don't have the sensor, I emulated it with a pulled-up switch (1-off, 0-on).
main.c
=================
#include "project.h"
#include "stdio.h"
volatile int prox_flag = 0 ;
char str[32] ; /* print buffer */
void print(char *str)
{
UART_UartPutString(str) ;
}
CY_ISR(prox_isr)
{
INTERRUPT_PIN_PROX_ClearInterrupt() ;
LED_Write(!LED_Read()) ;
prox_flag = 1 ;
}
void init_hardware(void)
{
UART_Start() ;
INTERRUPT_PIN_PROX_ClearInterrupt() ;
PROX_ISR_StartEx(prox_isr) ;
CyGlobalIntEnable; /* Enable global interrupts. */
}
void splash(void)
{
sprintf(str, "\nNegative ISR Test (%s %s)\n", __DATE__, __TIME__) ;
print(str) ;
}
int main(void)
{
init_hardware() ;
splash() ;
for(;;)
{
if (prox_flag) {
prox_flag = 0 ;
print("Prox INT received!\n") ;
}
}
}
=================
The UART output to the Tera Term was below, meantime, I could confirm that the LED flips.
Attached is my project for CY8C4146LQI-S433.
To use with your system, please change the device to CY8C4127AZI-S455
and/or change or remove, LED and/or UART and their pins.
Best Regards,
20-Jun-2019
Motoo Tanaka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Thomas,
What is the actual nature of input signal into the pin ? How do you expect the interrupt to be triggered ? What is the interrupt type setting in the ISR component ?
Best Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vasanth,
the input signal comes from a proximity sensor.
At the moment the interrupt is triggered when no hand is detected, but it should be triggered when a hand is detected. Unfortunately I can't invert the signal from the sensor.
The interrupt type setting is set to DERIVED.
Best regards,
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Although it looks somewhat messy I think that we can use SmartIO.
Note: I'm sorry, I have not tested this by myself, though.
schematic
SmartIO
LUT
And please call
SmartIO_1_Start() ;
at the beginning of your program.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Moto,
I tried it and I'm getting an error during digital placement.
I2807: The following instances could not be placed: PROX_ISR
E2806: Failed to place fixed-function blocks. See the report file for details.
Best regards,
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Thomas-san,
Sorry for the error, as you can tell, this is my first trial of this trick.
Anyway, how about changing the SmartIO and Schematic as below?
Best Regards,
19-Jun-2019
Motoo Tanaka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Moto,
I tried that already but then I get another error:
Error: mpr.M0172: Invalid connection for terminal "\SmartIO:cy_m0s8_prgio\:gpio7_o" connected to "PROX_ISR:interrupt". (App=cydsfit)
Best regards,
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Thomas-san,
I'm starting feeling myself a stupid, anyway 😉
With following schematic, I could generate application.
Then please assign a couple of pins to isr_out and isr_in then connect them outside the device.
So I'm trying to use SmartIO part as a NOT gate.
Best Regards,
19-Jun-2019
Motoo Tanaka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Thomas-san,
This morning I tried again,
and accidentally found that pin interrupt could be level, rising edge, "falling edge", and both edge!
So if you configure the pin's input interrupt as "Falling edge"
The original schematic should work
So I modified the schematic as below to test with my board which has CY8C4146LQI-S433
As I don't have the sensor, I emulated it with a pulled-up switch (1-off, 0-on).
main.c
=================
#include "project.h"
#include "stdio.h"
volatile int prox_flag = 0 ;
char str[32] ; /* print buffer */
void print(char *str)
{
UART_UartPutString(str) ;
}
CY_ISR(prox_isr)
{
INTERRUPT_PIN_PROX_ClearInterrupt() ;
LED_Write(!LED_Read()) ;
prox_flag = 1 ;
}
void init_hardware(void)
{
UART_Start() ;
INTERRUPT_PIN_PROX_ClearInterrupt() ;
PROX_ISR_StartEx(prox_isr) ;
CyGlobalIntEnable; /* Enable global interrupts. */
}
void splash(void)
{
sprintf(str, "\nNegative ISR Test (%s %s)\n", __DATE__, __TIME__) ;
print(str) ;
}
int main(void)
{
init_hardware() ;
splash() ;
for(;;)
{
if (prox_flag) {
prox_flag = 0 ;
print("Prox INT received!\n") ;
}
}
}
=================
The UART output to the Tera Term was below, meantime, I could confirm that the LED flips.
Attached is my project for CY8C4146LQI-S433.
To use with your system, please change the device to CY8C4127AZI-S455
and/or change or remove, LED and/or UART and their pins.
Best Regards,
20-Jun-2019
Motoo Tanaka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thomas.wiesnet,
Most likely there is huge noize ringing on the input pin, please check incoming signal with the scope. Maybe the data rate is too high.
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you really want to invert the interrupt input logic, This could be a solution using the Smart I/O. Sorry, I didn't confirm with an actual silicon.
The data4 output is connected to the P3_4 implicitly.
Is this what you want?
Regards,
Noriaki