HI, The mcu(MKE04Z8VWJ4) is used. The clk pin of SWD can not changed to IO,The dio pin of SWD can changed to IO .

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

HI, The mcu(MKE04Z8VWJ4) is used. The clk pin of SWD can not changed to IO,The dio pin of SWD can changed to IO .

798 Views
pliqy666
Contributor I

SIM->SOPT&= ~SIM_SOPT_SWDE_MASK; //0x8u 关闭SWD脚
SIM->SCGC&= ~SIM_SCGC_SWD_MASK; //0x2000u 关闭SWD时钟


GPIOA->PIDR&= (uint32_t)GPIO_PTA0_MASK; //禁用输入
GPIOA->PDDR|= (uint32_t)GPIO_PTA0_MASK; //输出方向
GPIOA->PSOR|= (uint32_t)GPIO_PTA0_MASK; //置位

GPIOA->PIDR|= (uint32_t)GPIO_PTA4_MASK; ///禁用输入
GPIOA->PDDR|= (uint32_t)GPIO_PTA4_MASK; //输出方向
GPIOA->PSOR|= (uint32_t)GPIO_PTA4_MASK; //置位

Labels (1)
0 Kudos
3 Replies

526 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Customer,

   This question, we already discuss it in the eefocus forum: http://www.nxpic.org/module/forum/thread-605837-1-1.html

   Your configuration code is correct to change PTA0 to the GPIO function.

   I think it is relate to your project, please check it, after this configuration, whether you configure the SIM_SOPT again?

  Because I have test it on my frmd-ke04 board, it works ok on my side.

  My main function is like this, which is modified from the KExx driver.

int main (void)
{
  unsigned int i,j;
    uint8_t         u8Ch;
ICS_ConfigType  sICSConfig;

    UART_ConfigType sConfig;
   
    /* Perform processor initialization */
   
    sysinit();
   
   printf("\nRunning the platinum project.\n");
    LED0_Init();  
    LED2_Init();
    //disable the SWD_CLK pin
    PORT->PUEL |= 0X01;
    SIM->SOPT&= ~SIM_SOPT_SWDE_MASK; //0x8u    
    SIM->SCGC&= ~SIM_SCGC_SWD_MASK; //0x2000u 
    GPIOA->PIDR|=  0x01; 
    GPIOA->PDDR|=  0x01;  
    GPIOA->PSOR|=  0x01;  
   

   printf("\nIt is in FEE mode now,");
while(1)
{
          printf("\nsim sopt= %x", SIM->SOPT);
        for(i=0;i<10;i++) for(j=0;j<65535;j++);
        GPIOA->PTOR|=  0x01; 
}
}

 

After this, I can get that the sopt is 0x04, the SWD pin function is the PTA0 function.

I can make the PTA0 toggle on my side.

So, please check your code carefully, whether you configure the SOPT again, or enbale the other module's in the PTA0  pin:

3.jpg

 

I also attach my test project for your reference.

 

Wish it helps you!

Have a great day,
Jingjing

 

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

0 Kudos

526 Views
pliqy666
Contributor I

HI,I have be finished the work, the trouble happened with the adc chanel 0 in using. Thank you very much !

Have a great day !

Qingyun Li

0 Kudos

526 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Qingyun,

    Thank you for your root problem sharing.

   If the question is solved, please click the Correct Answer button. Thank you!

Best Regards,

Jingjing

0 Kudos