2014-01-27 04:42 AM
Hi,
I have problem with SPI3 and st-link debugger. CLK pin is always unaveilable.I configure MCU to not use JTDO but in debug mode when I look at AFIO register there is written some other value for SWJ_CFG(always 0x50) and I want it to be 0x20.I already work with SPI1 and SPI2 and they work perfect in interrupt and non-interrupt mode.How to solve problem?there is little code: tmp = AFIO->MAPR; tmp &= 0xF8FFFFFF; tmp |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE; AFIO->MAPR = tmp; DBGMCU->CR &= ~DBGMCU_CR_TRACE_IOEN; //disable async trace for every caseit works same as GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); All the best,Miroslav #stm32 #stm32-st-link-swd #stm32discovery2014-01-27 04:47 AM
Hi,
Also PB3 pin, used for CLK I can't use for anything as I can't even toggle it like GPIO.Here are port settings: GPIO_InitStructure.GPIO_Pin = CLK | MOSI ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOB, &GPIO_InitStructure);2014-01-27 05:09 AM
Once you set it to AF, then you can't use it as a GPIO output.
JW2014-01-27 05:23 AM
Hi,
I use STM32F03 with st-link debbuger.It imposible to set AFIO register.Every value written will always be restored by debugger.2014-01-27 05:31 AM
As i said, when I set it to be GPIO out, not AF, I can't use it.
Next line: AFIO->MAPR = ''what ever I put''; will resul that MAPR is 0x04000000.That is also lie!!! Because 0x04000000 will disable JTAG and SW together but debugger continue working!2014-01-27 06:04 AM
AFAIK, STLink is a relatively dumb USB-to-JTAG/SWD convertor.
So, if you suspect ''something'' is overwriting the registers during debugging, it's the PC-side software you have to blame. You might want to review the documentation coming with that. JW2014-01-27 06:16 AM
2014-01-27 08:03 AM
All working now,
One global chip erase did the job.All the best and thanx for atention.Miroslav