External Interrupts INT 4 / 5 / 6 can't work at fx2

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
frank
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

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?

0 Likes
24 Replies
frank
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

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?

//interrupt 0 ,interrupt 1 , interrupt 10, interrupt 11 , interrupt 12 tells the compiler to look for the ISR at address 0x0003,0x0013,
//0x0053 ,0x005B,0x0063 respectively . The numbers 10,11 ,12 are derived from the natural priority of the interrupt for INT4/5/6 .
//Numbers 0 and 1 are (natural priority -1).
 
 
0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored
0 Likes
frank
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

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?

0 Likes
lock attach
Attachments are accessible only for community members.
frank
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

I use that KBA's example code.

I just modify the dscr.asm to HID interface and DR_GetDescriptor in bulkloop.c for implement.

The EXT interrupt 0 / 1 can't work.

Can help to check what's wrong here?

I attached file for reference

 

0 Likes
frank
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

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;

 

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

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

0 Likes

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

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

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

 

0 Likes

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

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Are you getting any linker memory error?

 

0 Likes

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

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

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

0 Likes

Hi

it visible in  【Human interface device】of device manager.

It bind mouse.inf driver.

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

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

0 Likes

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

 

0 Likes
frank
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

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

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

Hi,

Yes, you could try using another endpoint ( probably EP2/EP4) for HID class implementation and check.

 

0 Likes

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.

0 Likes
frank
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

Hi,

  It still can't work when I run in HID class, no matter which endpoint

 The external INT still can't work.

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

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.

 

0 Likes

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.

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

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.

0 Likes

OK, I will check it.

But the HID description related with the External INT?? really?

0 Likes
MallikaK_22
Moderator
Moderator
Moderator
50 likes received 750 replies posted 250 solutions authored

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

0 Likes