Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Connecting 16bit LCD: Port A vs port D or C. Same code but works differently

$
0
0

Hello! 
i try to connect 16bit LCD with stellaris launchpad and i succeed, but in port B (all port are available) and A (A0 and A1 are for JTAG and make me troubles randomly. Others are also available).

I change the function that write in port high of LCD to avoid this problem an use other port, but doesnt works well.

This is my first code (works well but use A0 and A1):

To init:
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIODirModeSet(GPIO_PORTA_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(GPIO_PORTA_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, GPIO_STRENGTH_8MA,GPIO_PIN_TYPE_STD); 

To write:
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, wh);


When i change init to this doesn't work:
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPadConfigSet(GPIO_PORTA_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, GPIO_STRENGTH_8MA,GPIO_PIN_TYPE_STD);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);

 I dont know why.. I believed are same functions but GPIOPinTypeGPIOOutput dont tell strenght or tristate mode.

Otherwise, my problem are when i change last code to:

to init:
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;
HWREG(GPIO_PORTD_BASE + GPIO_O_CR) = GPIO_PIN_7;
GPIODirModeSet(GPIO_PORTD_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(GPIO_PORTD_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, GPIO_STRENGTH_8MA,GPIO_PIN_TYPE_STD);
 

to write:
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, wh); 

 

Is the same code but in port D instead A and unlocking D7 (Vbus sense, i remove R15 in launchpad to use them. Also i remove R9 and R10).

When i mix pins of two ports to not use any not boosterpack pin i get the same problem.

Why works well in port A and not in port D?

Thanx 


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>