2017-08-23 11:56 AM
Turvey.Clive.002
‌Hi,
I am having trouble receiving 1024 bytes of data into the buffer inside HAL_UART_Receive(). Here are the details of the controller and the example code used:
Using the example code the project is tailored according to the controller used.
Changes made: removed uint32_t FLASH_If_GetWriteProtectionStatus(void); and
uint32_t FLASH_If_WriteProtectionConfig(uint32_t protectionstate); from flash_if.c since L031 does not support dual bank feature. Apart from this nothing else has been changed.UART pins used are PA2 --> TX and PA15--> RX
The user input from tera term works fine when 1,2, or 3 is entered for serial_download(); serial_upload() or jump to application.
When binary file is sent using teraterm ymodem protocol, the following is the flow of the program
if (packet_size >= PACKET_SIZE )
{status = HAL_UART_Receive(&UartHandle, &p_data[PACKET_NUMBER_INDEX], packet_size + PACKET_OVERHEAD_SIZE, timeout);/* Simple packet sanity check */
if (status == HAL_OK ) {.... performs CRC checkNote: I have set the user application to the flash address to which I am trying to download and also changed the VECTOR_TAB_OFFSET value to the same address location.
Is there any other setting I am missing for binary file transfer through UART? Any suggestions or help is much appreciated.
Thanks,
Harsha
null2017-08-23 01:12 PM
Can't really debug Cube issues for you.
Make sure the timeout is adequate for the number of bytes and baud rate you are attempting to read. Consider breaking the transfer into smaller pieces, ie each HAL_UART_Receive deals with 32 bytes, advancing into the buffer at each iteration.