From f03396802ae4c7106801bad94e9b9e997dbc94c3 Mon Sep 17 00:00:00 2001 From: Christina Quast Date: Fri, 9 Jan 2015 16:14:19 +0100 Subject: [PATCH] Debugging of smartcard insertion interrupt Currently the smartcard insertion interrupt is always triggered, but when checking in PIO_ISR which pin triggered the interrupt often times DTXD is returned (the debug transmit line which is printing debug messages at the moment..) --- sam3s_example/mains/at91lib_based_ccid_example.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sam3s_example/mains/at91lib_based_ccid_example.c b/sam3s_example/mains/at91lib_based_ccid_example.c index a44528d1..755c7fca 100644 --- a/sam3s_example/mains/at91lib_based_ccid_example.c +++ b/sam3s_example/mains/at91lib_based_ccid_example.c @@ -173,7 +173,11 @@ Output: +++++ Trying to check for pending interrupts (PIO ISR: 0x400)) = 1<<10 +++++ Mask: 0x100 = 1<<8 */ + // PA10 is DTXD, which is the debug uart transmit pin + + printf("Interrupt!!\n\r"); /* Check all pending interrupts */ + // FIXME: this if condition is not always true... if ( (pinSmartCard.pio->PIO_ISR & pinSmartCard.mask) != 0 ) { /* Check current level on pin */ @@ -181,11 +185,13 @@ Output: { sim_inserted = 1; printf( "-I- Smartcard inserted\n\r" ) ; + CCID_Insertion(); } else { sim_inserted = 0; printf( "-I- Smartcard removed\n\r" ) ; + CCID_Removal(); } } } @@ -317,7 +323,10 @@ extern int main( void ) } // FIXME. what if smcard is not inserted? - CCID_Insertion(); + if(PIO_Get(&pinSmartCard) == 0) { + printf("SIM card inserted\n\r"); + CCID_Insertion(); + } // Infinite loop while (1) {