Page 1 of 1

STM32F1 and JTAG disable

Posted: Fri Jan 01, 2016 7:54 pm
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

Re: STM32F1 and JTAG disable

Posted: Fri Jan 01, 2016 8:25 pm
by Giovanni
I never did that, please read carefully the RM and also the errata, there are several bugs affecting AFIO.

Giovanni

Re: STM32F1 and JTAG disable

Posted: Tue Jan 12, 2016 1:54 pm
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;
}