Hello!
I use TM4C123GE6PZI, date code 47 ANPYW.
The problem is that I can't configure ports J and K. Other ports (A to H) are works fine.
Here is my code:
extern void HardFault_Handler()
{
}
void delay()
{
uint32_t j;
for (j=0;j<100;j++);
}
void initPort(GPIOA_Type * portAddress)
{
// unlock GPIOCR registers to write (commit)
portAddress->LOCK = 0x4C4F434B;
portAddress->CR = 0xFF;
portAddress->DIR = 0xFF;
portAddress->ODR = 0x0;
portAddress->PUR = 0x0;
portAddress->PDR = 0x0;
portAddress->AFSEL = 0;
portAddress->AMSEL = 0;
portAddress->ADCCTL = 0;
portAddress->DMACTL = 0;
portAddress->PCTL = 0;
portAddress->DR8R = 0xFF;
portAddress->DEN = 0xFF;
}
int main()
{
SYSCTL->GPIOHBCTL |= 0xFF;
SYSCTL->RCGCGPIO = 0xFF;
initPort(GPIOA_AHB);
initPort(GPIOB_AHB);
#if !DEBUG
initPort(GPIOC_AHB);
#endif
initPort(GPIOD_AHB);
initPort(GPIOE_AHB);
initPort(GPIOF_AHB);
initPort(GPIOG_AHB);
initPort(GPIOH_AHB);
initPort(GPIOJ_AHB);
initPort(GPIOK);
while (1)
{
GPIOA_AHB->DATA = 0xAA;
GPIOB_AHB->DATA = 0xAA;
GPIOC_AHB->DATA = 0xAA;
GPIOD_AHB->DATA = 0xAA;
GPIOE_AHB->DATA = 0xAA;
GPIOF_AHB->DATA = 0xAA;
GPIOG_AHB->DATA = 0xAA;
GPIOH_AHB->DATA = 0xAA;
GPIOJ_AHB->DATA = 0xAA;
GPIOK->DATA = 0xAA;
delay();
GPIOA_AHB->DATA = 0x55;
GPIOB_AHB->DATA = 0x55;
GPIOC_AHB->DATA = 0x55;
GPIOD_AHB->DATA = 0x55;
GPIOE_AHB->DATA = 0x55;
GPIOF_AHB->DATA = 0x55;
GPIOG_AHB->DATA = 0x55;
GPIOH_AHB->DATA = 0x55;
GPIOJ_AHB->DATA = 0x55;
GPIOK->DATA = 0x55;
delay();
GPIOA_AHB->DATA = 0x00;
GPIOB_AHB->DATA = 0x00;
GPIOC_AHB->DATA = 0x00;
GPIOD_AHB->DATA = 0x00;
GPIOE_AHB->DATA = 0x00;
GPIOF_AHB->DATA = 0x00;
GPIOG_AHB->DATA = 0x00;
GPIOH_AHB->DATA = 0x00;
GPIOJ_AHB->DATA = 0x00;
GPIOK->DATA = 0x00;
delay();
GPIOA_AHB->DATA = 0xFF;
GPIOB_AHB->DATA = 0xFF;
GPIOC_AHB->DATA = 0xFF;
GPIOD_AHB->DATA = 0xFF;
GPIOE_AHB->DATA = 0xFF;
GPIOF_AHB->DATA = 0xFF;
GPIOG_AHB->DATA = 0xFF;
GPIOH_AHB->DATA = 0xFF;
GPIOJ_AHB->DATA = 0xFF;
GPIOK->DATA = 0xFF;
delay();
}
}
When I debug from Keil with ULINK2 I see, that any write to registers in function 'initPort' for GPIOJ_AHB or GPIOJ or GPIOK causes HardFault Exception. And the programm freezes if I don't use the function 'HardFault_Handler', that just do nothing and make return from exception's call.
So, ports J/K states as inputs.
May be I'm doing something wrong?