fix RV003_ADD_EXTI_HANDLER not being called when an interrupt arrives on the same EXTI line as USB_PIN_DP - #139
Conversation
…d on the same EXTI line as USB_PIN_DP
|
I think this is right. I always get KA / SE0 packets confused with this. Can you make sure you are still getting SE0 packets (for clock tuning), @ZimM-LostPolygon Also, cc'ing @monte-monte for visibility. |
|
Err now I am thinking it's the other way around. I can never remember if it's D+ or D- that signal SE0 on low speed because it's half-backwards from USB Full Speed |
|
Isn't it both D+ and D- going low that signals SE0? But regardless, the state of D+ seems irrelevant to me here - I don't think the state of D+ is even read at this point, but it's still trying to check EXTI_INTFR for an interrupt on D+, which doesn't exist |
|
But then it will still fail if another interrupt will be at PC3. |
|
Well that's normal and expected - you can't have multiple interrupts on the same EXTI line number. Or rather you can, but then you can't distinguish between them, which makes the interrupts useless in many cases, so typically you'd just carefully plan the interrupts so there's no overlap |
|
Ah sorry, I missed that we only set interrupt on DM pin originally. Then I agree this is an issue, and thank you for fixing it. |
|
Could this be merged? Is something else needs to be done? |
|
Sorry, I missed it. |
Context:
(Yes, D+/D- are swapped compared to the typical example code)
There is also another completely unrelated interrupt on pin C4. The problem is that, whenever C4 is triggered, RV003_ADD_EXTI_HANDLER never gets called. I believe it's because of this line:
rv003usb/rv003usb/rv003usb.S
Line 81 in 80b1893
In this case, it checks if EXTI_INTFR has either bit 3 or bit 4 set, even though D+ has no interrupt, sees that bit 4 is active (because it was pin C4 that triggered it), and never jumps to
another_interrupt_check.The suggested fix seems to work fine for me, but I'm not sure if there's some other big reason the check is done the way it is.