AN2417 Freescale Semiconductor / Motorola, AN2417 Datasheet - Page 16

no-image

AN2417

Manufacturer Part Number
AN2417
Description
PCMCIA and Compact Flash Interface for the MC9328MX1 and MC9328MXL Application Processors Application Note
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Programming Example
The procedures to configure Port A/B/C/D pin i as GPIO data input are:
3.3.2 GPIO Setting Requirement
The following table shows the GPIO signals required in the Compact Flash interface
3.3.3 GPIO Port A Setting
3.3.4 GPIO Port B Setting
3.4 Card Detect and Power Up
When Compact Flash Card is inserted in the socket, GPIO PA 20 will change from 1 to 0. Card insertion
can be detected by a negative edge interrupt or polling PA20 for low.
16
If i < 16, set bits [2*i +1] and [2*i] of Output Configuration Register1 (OCR1) as b11
If i >=16, set bits [2*i-32 +1] and [2*i-32] of Output Configuration Register2 (OCR2) as b11
Clear that bit i of Port A/B/C/D GPIO Data Direction Register (DDIR) to configure as input GPIO
pin.
Set bit i of Port A/B/C/D GPIO In Use Register (GIUS)
If internal pull high is required, set bit i of Port A/B/C/D Pull up Enable Register, Otherwise, bit i
should be clear
*(P_U32) PTA_GIUS = 0x00140000; // Set bit 18 and 20 of PTA_GIUS
*(P_U32) PTA_DDIR = ~(0x00140000); // Clear bit 18 and 20 of PTA_GIUS
*(P_U32) PTA_PUEN = 0x00000000;
*(P_U32) PTB_GIUS =0x00020000; // Set bit 17 of PTB_GIUS
*(P_U32) PTB_DDIR =0x00020000; // Set bit 17 of PTB_GIUS
*(P_U32) PTB_OCR2 = 0x0000000C;// Set bit 2 and 3 of PTB_OCR2
*(P_U32) PTB_DR &=~(0x1<<17); //Reset Pin =0
if ( ~( (*(P_U32) PTA_SSR) | 0xFFEFFFFF) )
while ( ~( (*(P_U32) PTA_SSR)|0xFFEFFFFF)){//poll for Card Detect,Quit loop when PA20=1
}
printf("Card inserted\n");
printf("waiting for card insertion\n");
GPIO
PA18
PA20
PB17
Freescale Semiconductor, Inc.
For More Information On This Product,
MC9328MX1/MXL Application Note
Engineering Draft / Preliminary
Go to: www.freescale.com
Connection to Compact Flash
Card Detect Logic Output
Table 12.
READY
RESET
GPIO Direction
Output
Input
Input
MOTOROLA

Related parts for AN2417