Hi Daniel,
I have found some errors in your code:
1. enable portA clock.
Please add this code before your do PORTA configuration.
SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;
2. for code have error.
for(int i=0; i<200000; i++){}
int i, the max data is 32767, so if you use for(int i=0; i<200000; i++){}, the code won't execute toggle GPIO.
You can use this code for delay:
unsigned int i,j;
for(i=0;i<10;i++) for(j=0;j<65535;j++);
I have tried to disable the reset function on the PTA1, and the PTA1 can toggle.
After you download the code, please power on your board again, and test the reset pin.
Following code for your reference in main, after modify the FOPT to 0XB5:
SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK;
PORTA_PCR1 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
GPIOA_PDDR |= 1<<1;
GPIOA_PSOR |= 1<<1;
while (1)
{
for(i=0;i<10;i++) for(j=0;j<65535;j++);
GPIOA_PTOR |= 1<<1;
}
If you still have question, please let me know!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------