- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use the example code in FX3 SDK for Bulkloop_SDCC of FX2LP
I want to enable the external interrupts.
It works well for INT 1/2, but it doesn't work for INT 4/5/6.
It seems can't run into interrupt 10 / 11 / 12.
What's wrong here?
In the TD_Init()
//INT4#
INTSETUP &= ~0x02; // If INTSETUP.1=0,then INT4 is supplied by the pin.Else, the interrupt is supplied internally FIFO/GPIF sources.
//INT5# is a dedicated pin , available in the 100 amd 128 pin packages.
//INT6#
PORTECFG = 0x20; // PE5 is INT6
OEE &= ~0x20;
//Enable External Interrupts
EIE |= 0x1C; // Enable External Interrupts 4, 5 and 6
IE |= 0x05; // Enable External Interrupts 0 and 1
//Clear Flags
EXIF &= 0xBF; // Clear INT4 EXIF.6 Flag
EXIF &= 0x7F; // Clear INT5 EXIF.7 Flag
EICON &= 0xF7; // Clear INT6 EICON.3 Flag
EA = 1; // Enable Global Interrupt
// for interrupt function
void ISR_EXTR4(void) __interrupt 10
{
EXIF &= 0xBF; // Clear INT4 EXIF.6 Flag
IOB ^= 0x08; // Toggle pin 3 of PortB
}
void ISR_EXTR5(void) __interrupt 11
{
EXIF &= 0x7F; // Clear INT5 EXIF.7 Flag
IOB ^= 0x08; // Toggle pin 3 of PortB
}
void ISR_EXTR6(void) __interrupt 12
{
EICON &= 0xF7; // Clear INT6 EICON.3 Flag
IOB ^= 0x08; // Toggle pin 3 of PortB
}
//USB jump table
.area AUTOVECTOR (CODE,ABS)
.org 0x0043
ljmp _USB_Jump_Table ; Autovector will replace byte 45
.org 0x0053
;; USB_Int4AutoVector equ $ + 2
ljmp _USB_Jump_Table ; Autovector will replace byte 55
what do I miss something?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After I check again, I found all the external INT not work
It seems the external INT can't enter the corresponding the function.
What should I fix here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please refer to this KBA: https://community.cypress.com/t5/Knowledge-Base-Articles/FX2-FX2LP-SDCC-Eclipse-Project-Interrupt-no...
Regards,
Mallika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I try the attached file form the KBA from you mention.
It work well for ext INT0 / 1.
I modify my own project for
1. sdcc --xram-loc 0x3000 --code-size 0x2FFF
2.by adding the following line of code to the fx2regs.h file of the project:
__sfr __at (0x92) _XPAGE;
Whole project almost same as the example code, just alternate for HID and put the descriptor from 0xE000 to 0x0080
The I2C INT、EP1 IN / OUT Endpoint interrupts work fine, just External INT 0 / 1 / 4 / 5 / 6 can't work at all.
What should I care here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I disable the enpoint 1 IN/OUT,it work
It seems conflict between Endpoint 1 and external INT.
*********************************************
It doesn't work
EP1OUTCFG = 0xB0;
EP1INCFG = 0xB0;
************************************************
it work well
EP1OUTCFG = 0x30;
EP1INCFG = 0x30;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please confirm if I've understood the issue correctly-
When you used the project attached along with the KBA I had mentioned in my previous response, the external interrupts work fine. But if you modify the firmware to support HID class, the external interrupts don't work. Is this correct?
Regards,
Mallika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Yup, it work the projected attached, but if I modify the firmware to support HID class to use Endpoint1, the external interrupts don't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It seems like the endpoint interrupt execution is not proper. Please check section 6 in this App Note for interrupt handling in FX2LP: https://www.cypress.com/file/114426/download
The following two lines enable the interrupts of the EP1 endpoint:
EPIE |= bmBIT3 ; // Enable EP1 OUT Endpoint interrupts
EPIE |= bmBIT2; // Enable EP1 IN Endpoint interrupts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi :
I put the below code in TD_Init()
EP1OUTCFG = 0xB0;
EP1INCFG = 0xB0;
SYNCDELAY; // see TRM section 15.14
EPIE |= (bmBIT3 | bmBIT2); // Enable EP1 IN / OUT Endpoint interrupts
EP1OUTBC = 0x40;
and the ENDPOINT 1 IN / OUT work OK
void ISR_Ep1out(void) __interrupt 0
void ISR_Ep1in(void) __interrupt 0
......But the external PIN still can't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you getting any linker memory error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi :
No, no any error or warning message
Building target: OU1Bridge.hex
Invoking: SDCC Linker
sdcc --xram-loc 0x3000 --code-size 0x2FFF -o "test.hex" ./EZRegs.rel ./USBJmpTb.rel ./delay.rel ./delayms.rel ./discon.rel ./dscr.rel ./fw.rel ./get_strd.rel ./i2c.rel ./i2c_himax.rel ./i2c_rw.rel ./isr.rel ./resume.rel ./susp.rel ./transfer.rel
Finished building target: test.hex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please let me know how is the device enumerating and visible in device manager?
Also, which driver does it binds with?
Regards,
Mallika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
it visible in 【Human interface device】of device manager.
It bind mouse.inf driver.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you try using another endpoint, apart from EP0 and EP1 for HID implementation.
For reference: https://www.cypress.com/file/123281/download
Regards,
Mallika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi :
Now I use EP1 for IN / OUT
You want me to try
1. EP1 for OUT and EP0 for IN,
2. Exclude EP0 / EP1 for IN / OUT, let me use EP2/EP4 for IN/OUT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BUT as I know EP0 just a setup package, it can't as a interrupt endpoint ,
If you mean method one, I think I just can implement EP1/EP2 for IN / OUT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Yes, you could try using another endpoint ( probably EP2/EP4) for HID class implementation and check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I already try EP2 OUT and EP6 IN, it same can't work well.
If implement HID at FX2, I can't work the EXT INT.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It still can't work when I run in HID class, no matter which endpoint
The external INT still can't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm extremely sorry for the delay.
Could you please try using the project attached here: https://www.cypress.com/documentation/application-notes/an64020-creating-fx1fx2lp-composite-hid-devi...
This is for HID only and has 2 interfaces- for mouse & keyboard. Probably you can use only any one if convenient.
>> Kindly create a separate isr.c file and declare the ISRs for the external interrupts INT0 and INT1 as it was done in the previous FX2LP_ISR project which you were using.
>> Also, create a similar isr.h file that declares the functions present in isr.c file.
>> Add the reference to isr.h file in both isr.c and fw.c file.
Then build the project and let us know if it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
I think it can't use that project you send, because it base on Keilc.
Maybe we have problem with SDCC, it can't solve my problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Maybe you could check the HID descriptors defined in your original project once. They don't seem proper.
For reference, you can use the HID project which I have shared with you in my previous response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, I will check it.
But the HID description related with the External INT?? really?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Apologies for the delay in response.
Kindly try, if possible, adding HID descriptor in the extr_intr project (Keil IDE) also. The default extr_intr path can be found at :C:\Cypress\USB\CY3684_EZ-USB_FX2LP_DVK\1.1\Firmware after downloading CY3684 EZ_USB_FX2LP_DVK.
https://www.cypress.com/documentation/development-kitsboards/cy3684-ez-usb-fx2lp-development-kit
Regards,
Mallika