cancel
Showing results for 
Search instead for 
Did you mean: 

Operation on PC10 causing interference with JTAG comm.?

StephanMair
Senior
Posted on January 08, 2015 at 12:38

Hello, a while back I encountered a problem where I am unable to JLink-debug my project. Now I have pinpointed the exact line of the problem:

GPIO_SetBits   (GPIOC,GPIO_Pin_10);

It's a library func. I've checked the datasheet and found that PC10 has nothing to do with JTAG connection whatsoever, and most JTAG pins are with either BankA or BankB.

I pinpointed this line because after I commented it, everything became just fine. I pinpointed this exact line in a ''module (.c file) exclusion, then function exclusion, then line by line commenting '' manner.

Interference manifests ultimately in the form of program stopping by itself, to be more precise, way before the main() func, even before the system initialization �? or in other words, the interference is so fierce that it stopped program from running at all, under the debug mode of keil.

Can someone please provide a little insight as why might such thing happen?

*Note that the interference starts before the system_init function of the .s startup file even get executed.*

Development Env. & Hardware:

Keil μV4

Jlink

STM32F105RBT6
3 REPLIES 3
Posted on January 08, 2015 at 14:53

Can someone please provide a little insight as why might such thing happen?

External circuit issues, components, shorts?
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
StephanMair
Senior
Posted on January 09, 2015 at 00:32

Thank you Clive.

A hardware error is possible but very, very unlikely. I've checked the circuit thrice. Circuitry is something you always begin troubleshooting with.

But I'll definitely check it again, since complicated problems sometimes have a very straightforward and stupid mistake.

Meanwhile, I'd like to ask a far out question: what's the chance of this line of code accidentally been written into the wrong part of the flash, causing some registers fail to perform normally? It is possible that, for example, I entered the wrong flash adress range in the configuration for the chip?

Posted on January 09, 2015 at 01:49

Well can you replicate the issue with a VL-Discovery board, or other 105/107 board?

PC10 is right next to JTDI (PA15) on many device pin configurations. Suggest you try a simple GPIO experiment, remapping the JTAG (ie SWD only mode), and driving PA15 High and Low, and observing if PC10 as an input follows it.

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | 
RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE);
/* Disable the Serial Wire Jtag Debug Port SWJ-DP */
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
/* Configure PA.13 (JTMS/SWDAT), PA.14 (JTCK/SWCLK) and PA.15 (JTDI) as
output push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure PB.03 (JTDO) and PB.04 (JTRST) as output push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Configure PC.10 pin as input floating */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* JTDI pin Low */
GPIO_WriteBit(GPIOA, GPIO_Pin_15, 0);
printf(''%d
'',GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_10));
/* JTDI pin High*/
GPIO_WriteBit(GPIOA, GPIO_Pin_15, 1);
printf(''%d
'',GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_10));

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..