|
|
@@ -144,6 +144,7 @@ HAL_StatusTypeDef Interface_Receive(uint8_t* bytes, uint16_t size, uint32_t time
|
|
|
if(timeoutCount > timeoutFinal){
|
|
|
timeoutCount = 0;
|
|
|
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
|
|
|
+ bytes[0] = 0;
|
|
|
return HAL_TIMEOUT;
|
|
|
}
|
|
|
HAL_Delay(1);
|
|
|
@@ -317,14 +318,12 @@ void Main_Cycle(void)
|
|
|
{
|
|
|
if(sKey[0] == 'S')
|
|
|
{
|
|
|
- uint8_t verStr[] = "BLA_V_1_01_250705\r\n";
|
|
|
- Interface_Transmit(verStr, sizeof(verStr), 100);
|
|
|
if(sKey[1] == '3'){
|
|
|
Interface_Clean();
|
|
|
Interface_PutString("\r\nStart program execution...\r\n");
|
|
|
JumpToAppWithReset();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
else if(sKey[1] == '1'){
|
|
|
Interface_Clean();
|
|
|
if(Interface_Download() != COM_OK){
|
|
|
@@ -772,6 +771,8 @@ uint8_t aFileName[FILE_NAME_LENGTH];
|
|
|
* @retval HAL_OK: normally return
|
|
|
* HAL_BUSY: abort by user
|
|
|
*/
|
|
|
+ uint8_t byteOneTmp = 0;
|
|
|
+ HAL_StatusTypeDef statusA;
|
|
|
static HAL_StatusTypeDef ReceivePacket(uint8_t* p_data, uint32_t* p_length, uint32_t timeout)
|
|
|
{
|
|
|
uint32_t crc;
|
|
|
@@ -781,6 +782,8 @@ static HAL_StatusTypeDef ReceivePacket(uint8_t* p_data, uint32_t* p_length, uint
|
|
|
|
|
|
*p_length = 0;
|
|
|
status = Interface_Receive(&byteOne, 1, timeout);
|
|
|
+ statusA = status;
|
|
|
+ byteOneTmp = byteOne;
|
|
|
|
|
|
if(status == HAL_OK)
|
|
|
{
|
|
|
@@ -998,6 +1001,7 @@ uint8_t CalcChecksum(const uint8_t* p_data, uint32_t size)
|
|
|
* @param p_size The size of the file.
|
|
|
* @retval COM_StatusTypeDef result of reception/programming
|
|
|
*/
|
|
|
+HAL_StatusTypeDef statA = HAL_OK;
|
|
|
COM_StatusTypeDef Ymodem_Receive(uint32_t* p_size)
|
|
|
{
|
|
|
uint32_t i, packet_length, session_done = 0, file_done, errors = 0, session_begin = 0;
|
|
|
@@ -1015,7 +1019,8 @@ COM_StatusTypeDef Ymodem_Receive(uint32_t* p_size)
|
|
|
file_done = 0;
|
|
|
while((file_done == 0) && (result == COM_OK))
|
|
|
{
|
|
|
- switch(ReceivePacket(aPacketData, &packet_length, DOWNLOAD_TIMEOUT))
|
|
|
+ statA = ReceivePacket(aPacketData, &packet_length, DOWNLOAD_TIMEOUT);
|
|
|
+ switch(statA)
|
|
|
{
|
|
|
case HAL_OK:
|
|
|
errors = 0;
|