AnsweredAssumed Answered

IAP USART receive through hyper terminal not working

Question asked by Harsha Jagadish on Aug 21, 2017
Latest reply on Aug 22, 2017 by Clive One

Hi,

 

I am using STM32 controller board for the first time. I am trying to implement IAP using UART. I have gone through the AN4657 document.  I am aware that X-CUBE-IAP-USART firmware package contains the source code of IAP examples based on the STM32Cube. Refering to this example code I have built the IAP code for STM32L031K6T6 microcontroller. 

 

Since the controller I am using does not support dual bank feature I have discarded the uint32_t FLASH_If_GetWriteProtectionStatus(void) and uint32_t FLASH_If_WriteProtectionConfig(uint32_t protectionstate) from flash_if.c file. Except this change nothing else is modified. I am able to build with 0 errors. However when I connect to Tera Term using the configuration mentioned in readme.doc file, I can see the menu being displayed on Tera Term but when I enter the option 1, 2 or 3 to perform serial download (), upload() or jump to application, nothing gets received on the receive data register(RDR). The program control gets into the following handler and returns HAL_TIMEOUT;

 

HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Tickstart, uint32_t Timeout)
{
/* Wait until flag is set */
while((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Status)
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((Timeout == 0) || ((HAL_GetTick()-Tickstart) > Timeout))
{

/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */
CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE));
CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE);

huart->gState = HAL_UART_STATE_READY;
huart->RxState = HAL_UART_STATE_READY;

/* Process Unlocked */
__HAL_UNLOCK(huart);
return HAL_TIMEOUT;
}
}
}
return HAL_OK;
}

 

1. I am not able to receive the key, which is a user input from the tera term. Using mbed compiler I test the blinky example code--receiving from hyper terminal. when 1 is entered, LED is ON and when 0 is entered LED OFF. I tested this to see if the teraterm version I am using works fine. It did work. But when HAL_UART_Receive() function is used I am having trouble receiving from terminal.

2. Also, using the UART example from STM32Cube_FW_L0_V1.9.0/Projects/STM32L031K6-Nucleo/Examples/UART, the UART_twoBoards_ComPolling works fine using two STM32L031 boards, but the UART_HyperTerminal_DMA fails to receive any data from the Tera Term.

 

When I hard code the key value and enter ymodemreceive(),  then use YMODEM send through TeraTerm to send a binary file, it fails to receive any data packets. It just goes to default case and keeps printing CCCCCCCCCCC... on the tera term window which indicates that it is ready to receive. I switched from Tera Term to other console application like Putty/Terminal/Herculus. Was neither successful in receiving  the user input nor a binary file using HAL_UART_Receive().

 

I want to know if I am missing any settings or if I have to use any hardware set up for serial communication. If anyone has implemented IAP on STM32L031k6t6 board, please help. Thank you,

 

 

Outcomes