2016-06-20 02:16 PM
Hi
I'm struggeling with this problem. I have very simple (two threads) system, that wait for characters from usart. Everything work ok untill I turn on debug session. Then after a while it breaks it with known communicat ''Cannot access target. Shutting down debug session'' I recive characters using interrupts: void USART1_IRQHandler (void) { if(USART1->ISR & USART_ISR_RXNE) { msgBuffor[msgWritePtr++] = USART1->RDR; if (msgWritePtr > MESSAGE_BUF_SIZE) { msgWritePtr = 0; } } } Initialisation precedure: void USART1_init(void) { RCC->APB2ENR |= RCC_APB2ENR_USART1EN; RCC->CFGR3 &= ~RCC_CFGR3_USART1SW; RCC->CFGR3 |= RCC_CFGR3_USART1SW_0; gpio_pin_cfg(TX_PORT, TX_PIN, GPIO_AF7_PP_50MHz); gpio_pin_cfg(RX_PORT, RX_PIN, GPIO_AF7_PP_50MHz); USART1->BRR = SystemCoreClock/115200UL; USART1->CR1 |= USART_CR1_TE | USART_CR1_RE | USART_CR1_RXNEIE; USART1->CR1 |= USART_CR1_UE; NVIC_EnableIRQ( USART1_IRQn ); } My findings so far: - when no characters are received - problem does NOT appear, - when interrupts are blocked obvieusly problem does NOT appear, - it is not power issiue - checked with an oscilloscope - CMSIS doesn't stuck in any fault handler procedure - when run in normal mode both threads works properly (checked with LEDs) - when debug session is stopped threads go further normaly Any good idea is welcome2016-06-20 02:41 PM
Assume it is not the code you have chosen to show..
Using WFI anywhere?