I am using the stm8l151... mcu and I am trying to send different strings via Uart1 to HTerminal. I have three different strings to send. The first two strings are transmitted completely but when the third one is being sent, it is truncated and it starts to send the first and second string again and repeatedly but when i go through the code step by step, it works normal.
I have attached the output from Hterm (uart_com) for better understanding and also some parts of my code(uart transmit and uart_init)
Just for better understanding of the attached output, the strings(cmd 1, 2 and 3) are at+nrb, at+cfun=1, and at+cops=1,2,"26201"
Please Any suggestion will be greatly appreciated.😊
Hello,
I am using the stm8l151... mcu and I am trying to send different strings via Uart1 to HTerminal. I have three different strings to send. The first two strings are transmitted completely but when the third one is being sent, it is truncated and it starts to send the first and second string again and repeatedly but when i go through the code step by step, it works normal.
I have attached the output from Hterm (uart_com) for better understanding and also some parts of my code(uart transmit and uart_init)
Just for better understanding of the attached output, the strings(cmd 1, 2 and 3) are at+nrb, at+cfun=1, and at+cops=1,2,"26201"
Please Any suggestion will be greatly appreciated.😊
`void nbiot_buf_transmit(void){ PAL_UART1_RX_DISABLE(); PAL_UART1_TX_ENABLE();
}
for(int i=0 ; i < sizeof(cmd2);i++){
}
for(int i=0 ; i < sizeof(cmd3);i++){
}`
`void uart_init(void){ / init Tx and Rx Pins / GPIO_Init(GPIOC, GPIO_Pin_3, GPIO_Mode_Out_PP_High_Fast); //tx pin output GPIO_Init(GPIOC, GPIO_Pin_2, GPIO_Mode_In_FL_No_IT); //rx pin input / enable usart1 clk / (CLK->PCKENR1 |= (uint8_t)((uint8_t)1 << ((uint8_t)CLK_Peripheral_USART1 & (uint8_t)0x0F))); / config for GPIO mode / (CLK->PCKENR2 |= (uint8_t)((uint8_t)1 << ((uint8_t)CLK_Peripheral_COMP & (uint8_t)0x0F)));
(RI->IOCMR3 &= 0xFD); (RI->IOSR3 &= (uint8_t) (~(uint8_t) ((uint8_t)1 << (uint8_t) (RI_IOSwitch_6 & (uint8_t) 0x0F))));
(CLK->PCKENR2 &= (uint8_t)(~(uint8_t)(((uint8_t)1 << ((uint8_t)CLK_Peripheral_COMP & (uint8_t)0x0F)))));
/ init usart peripheral / USART_Init(USART1, (PAL_dwCLK_FREQ_VALUE/9600), USART_WordLength_8b, USART_StopBits_1, USART_Parity_No, USART_Mode_Rx); //Rx enable ITC->ISPR8 &= 0xFC; // Set USART1_RX_IRQn on ITC_PriorityLevel_2 ITC->ISPR7 &= 0x3F; // Set USART1_TX_IRQn on ITC_PriorityLevel_2 / enable usart1 peripheral / USART_Cmd(USART1,ENABLE);
}`