Hi
I want to use the LCDC LD0 and LD1 as GPIO output pins.
From reading the 5329 ref manual, they default to GPIO and configured as inputs..
But I have configured it for GPIO anyway. I can set and clear LD0 but
can't seem to do anything with LD1.
I have used the following code to configure and drive.
VMCF5329_GPIO_STRUCT_PTR gpio = &((VMCF5329_STRUCT_PTR)_PSP_GET_IPSBAR())->GPIO;
gpio->PAR_LCDDATA = 0; //configure as GPIO
gpio->PDDR_LCDDATAL = 0x03; //LD0 and LD1 as output
gpio->PPDSDR_LCDDATAL = MCF5329_GPIO_PPDSDR_x0 || MCF5329_GPIO_PPDSDR_x1; //to set LD0 & LD1
gpio->PCLRR_LCDDATAL = MCF5329_GPIO_PCLRR_x0 || MCF5329_GPIO_PCLRR_x1; // to clear LD0 & LD1
I have also tried
gpio->PODR_LCDDATAL = 0x0;
gpio->PODR_LCDDATAL = 0x3;
I can see LD0 changing state but not LD1. Not sure what I doing wrong or missed anything out.
Note : I have not done anything with drive strength.
Thanks
Solved! Go to Solution.
Hi Tom
Just tried the addresses rather than the macros. It still behaves the same way.
Added a line to show the current status of the port, from this I could see LD1 was always 0.
I checked the modifications carried out and found that LD1 was shorted to gnd. Once
this was sorted all worked as expected.
Thanks
Jaswinder
From the manual that should work. I have an MCF5329 here on a board, connected to a video chip. It doesn't have LD0 connected, but it does have LD1 connected to the video, and I can see the effect of writing LD1 as a GPIO. I'm using GDB through a P&E Multilink:
(gdb) x/b 0xfc0a405d # LCD Pin Assignment Register 0xfc0a405d: 0xff # Set to LCDC (gdb) set *(uint8_t *)0xfc0a405d = 0xfc # LCD Pin Assignment Register, set LD0-LD7 as GPIO (gdb) set *(uint8_t *)0xfc0a4023 = 0x03 # LCD PDDR, LD0, LD1 as output. (gdb) set *(uint8_t *)0xfc0a400f = 0x00 # All pins low (gdb) set *(uint8_t *)0xfc0a400f = 0x02 # LD1 high
I'd check that the macros you're using are generating the right addresses.
I'd also read back the registers in a debugger - and set them in the debugger too.
It may be a hardware problem. Change LD1 to an input and see if you can send signals into that pin.
Tom
Hi Tom
Just tried the addresses rather than the macros. It still behaves the same way.
Added a line to show the current status of the port, from this I could see LD1 was always 0.
I checked the modifications carried out and found that LD1 was shorted to gnd. Once
this was sorted all worked as expected.
Thanks
Jaswinder