LPC822 write to PINENABLE0 results in bogus values

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC822 write to PINENABLE0 results in bogus values

559 Views
neontr
Contributor I

Hello everyone,

I am running my program on a LPC822M101JHI33.

The programs entry point is at 0x200, enabling me to run it directly from the bootloader without reset via "G 512 T"

In the program I am doing the following steps:

Setting stack pointer (msr msp, msr psp) to end of RAM

Writing 2 to 0x40048000, enabling my own interrupt vectors, and no longer those of the bootloader

The normal C startup things: etext => data, clear of bss

Next,the following LPCOpen calls:

Chip_SystemInit();

SystemCoreClockUpdate();
Chip_GPIO_Init(PC_GPIO_PORT);

SysTick_Config(SystemCoreClock / 1000);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
for (int i = 0; i < 12; i++) // just in case bootloader resets stuff
LPC_SWM->PINASSIGN[i] = 0xFFFFFFFF;

Next, I want to disable the fixed PINs SWDIO and SWCLK:

Chip_SWM_DisableFixedPin(SWM_FIXED_SWCLK);
Chip_SWM_DisableFixedPin(SWM_FIXED_SWDIO);

Every once in a while (about every 3rd reset) this writes bogus stuff into PINENABLE0, instead of just setting the 2 bits of PINENABLE0 to 1. This breaks GPIO in general (and most probably also other stuff).

If I do not do the 2 Chip_SWM_DisableFixedPin calls, the rest of the program runs fine. With lots of GPIO Stuff, UART communication, and SysTick handling.

Can anybody help so I can use the two pins of SWCLK and SWDIO for GPIO? Is it because of the bootloader? What's it setting which I have to reset first? Or is it a different problem

Thank you!

Thomas

Labels (2)
0 Kudos
1 Reply

407 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Thomas,

    You said, when you disable the SWDIO and SWDCLK, every once in a while (about every 3rd reset) this writes bogus stuff into PINENABLE0.

    Please tell me how did you detect the bogus stuff is wrote to the PINENABLE0? Please also give me your test result.

    Waiting for your reply!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos