AnsweredAssumed Answered

LPC546xx iso7816 driver

Question asked by yangyong wu on Dec 27, 2018
Latest reply on Dec 27, 2018 by yangyong wu

Hello.

 

I want to implement ISO7816 interface using LPC54608 smartcard interface. According to UM10912 , lpc546xx series can support ISO7816 interface. I found there were no ISO7816 driver example in SDK_2.x_LPC54608,  so I decided to do it by myself. so  configure  sci0_io, sci0_sclk ,gpio reset and gpio VCC .  In the end ,it didn't work. so If there is the ISO7816 driver example code under lpc546xx platform, please let me know. thanks.

 

/* pin configs */

CLOCK_EnableClock(kCLOCK_SmartCard0);

 

CLOCK_SetClkDiv(kCLOCK_DivSmartCard0Clk, 3U, false);     /* main clk  12M */

smartcard interface:

base->OSR =  0 | SMARTCARD_OSR_OSFRAC(0b111)| SMARTCARD_OSR_OSINT(0b1111) | SMARTCARD_OSR_FDINT(0b0010111);

base->DLL = SMARTCARD_DLL_DLLSB(0x74); /* The SCIn Divisor Latch LSB Register(DLAB = 1) */

base->DLM = SMARTCARD_DLM_DLMSB(0x01); /* The SCIn Divisor Latch LSB Register(DLAB = 1) */

base->LCR = SMARTCARD_LCR_WLS(3)  /* 8-bit character length */

| SMARTCARD_LCR_SBS(0) /* 1 stop bit */

| SMARTCARD_LCR_PE(1) /* Enable parity generation and checking */

| SMARTCARD_LCR_PS(1) /* Even Parity. */

| SMARTCARD_LCR_DLAB(1); /* Enable access to Divisor Latches */

 

base->FCR = SMARTCARD_FCR_FIFOEN(0) /* FIFO Enable */

| SMARTCARD_FCR_RXFIFORES(0) /* RX FIFO Reset.

1: Writing a logic 1 to SCInFCR[1] will clear all bytes in SCIn Rx FIFO, reset the pointer logic. This bit is self-clearing

        0: No impact on either of SCIn FIFOs

        */

| SMARTCARD_FCR_TXFIFORES(0) /* TX FIFO Reset.

0: No impact on either of SCIn FIFOs.

1: Writing a logic 1 to SCInFCR[2] will clear all bytes in SCIn TX FIFO, reset the pointer logic. This bit is self-clearing.

        */

| SMARTCARD_FCR_DMAMODE(0) /* DMA Mode Select. When the FIFO enable (bit 0 of this register) is set */

| SMARTCARD_FCR_RXTRIGLVL(0x02); /* RX Trigger Level. Trigger level 2 (8 characters or 0x08).*/

 

base->IER = SMARTCARD_IER_RBRIE(1) /* RBR Interrupt Enable */

| SMARTCARD_IER_THREIE(1) /* THRE Interrupt Enable */

| SMARTCARD_IER_RXIE(1); /* Enable the RX line status interrupts */

 

base->SCICTRL =  SMARTCARD_SCICTRL_SCIEN(1) /* Smart Card Interface Enable */

| SMARTCARD_SCICTRL_NACKDIS(1) /* A NACK response is enabled */

| SMARTCARD_SCICTRL_PROTSEL(1) /* T=0 */

| SMARTCARD_SCICTRL_TXRETRY(2) /* tx retry times: 0 */

| SMARTCARD_SCICTRL_GUARDTIME(0xff); /* Extra guard time */

Outcomes