STM32F1 and JTAG disable

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
drgowen
Posts: 12
Joined: Tue Aug 27, 2013 3:28 pm

STM32F1 and JTAG disable

Post by drgowen »

Hi folks

I've been tearing my hair out over this. I want to use PB3 as a GPIO and am currently doing the following:

Code: Select all

 halInit();
  chSysInit();

  AFIO->MAPR |= ((0b010)<<10); //(tim3 remap)
  AFIO->MAPR |= ((0b010)<<24); (SWJ_CONFIG)
  palSetPadMode(GPIOB, 3, PAL_MODE_STM32_ALTERNATE_PUSHPULL);


at the beginning of main. But sufficed to say it's still not allowing pb3 to function as GPIO.

What is the correct procedure for this?

Many thanks
Gareth
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F1 and JTAG disable

Post by Giovanni »

I never did that, please read carefully the RM and also the errata, there are several bugs affecting AFIO.

Giovanni
zhu
Posts: 2
Joined: Tue Jan 12, 2016 12:28 pm
Been thanked: 1 time

Re: STM32F1 and JTAG disable

Post by zhu »

hi,
try add afio mapping in boardInit method

/*
* Board-specific initialization code.
*/
void boardInit(void)
{
//JTAG-DP Disabled and SW-DP Enabled
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE;
}
Post Reply