• STM32C8T6 JTAG使用到PB3|PB4|PA13|PA14|PB15端口做普通IO时,需禁止JTAG!


     GPIO_InitTypeDef GPIO_InitStructure;
     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC|RCC_APB2Periph_AFIO, ENABLE);
     
     /**********************
     1.执行端口重映射时,复用功能时钟得使能:RCC_APB2Periph_AFIO
     
     2.  &1.GPIO_Remap_SWJ_Disable: !< Full SWJ Disabled (JTAG-DP + SW-DP)
          此时PA13|PA14|PA15|PB3|PB4都可作为普通IO用了
     
     为了保存某些调试端口,GPIO_Remap_SWJ_Disable也可选择为下面两种模式:
      
         &2.GPIO_Remap_SWJ_JTAGDisable: !< JTAG-DP Disabled and SW-DP Enabled
         此时PA15|PB3|PB4可作为普通IO用了
      
         &3.GPIO_Remap_SWJ_NoJTRST: !< Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST
         此时只有PB4可作为普通IO用了 
     **********************/
     
     GPIO_PinRemapConfig(GPIO_Remap_SWJ_NoJTRST, ENABLE);  //使能禁止JTAG

     //初始化GPIOB  推挽输出
     GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_3|GPIO_Pin_4);
     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;  
     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;  
     GPIO_Init(GPIOB, &GPIO_InitStructure); 
     GPIO_SetBits(GPIOB, GPIO_Pin_3|GPIO_Pin_4);
     //初始化GPIOA  推挽输出
     GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15);  
     GPIO_Init(GPIOA, &GPIO_InitStructure); 
     GPIO_SetBits(GPIOA, GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15);

  • 相关阅读:
    Ultra-QuickSort(归并排序求逆序对数)
    Power Network (最大流增广路算法模板题)
    Sorting It All Out
    Asteroids(二分图最大匹配模板题)
    昂贵的聘礼
    Borg Maze(bfs+prim)
    Currency Exchange(判断是否有正环)
    Children of the Candy Corn (bfs+dfs)
    Tautology
    Flip Game
  • 原文地址:https://www.cnblogs.com/zhaocundang/p/5916047.html
Copyright © 2020-2023  润新知