Uart bootloading error code 3

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I have been working on a bootloader host program and have run into an issue when it comes to the program row portion of the operation, this process is explained in detail in Appendix C on document AN 68272 ( found on AN68272 - PSoC® 3, PSoC 4, PSoC 5LP, and PSoC Analog Coprocessor UART Bootloader  ) . The issue is when the program row operation is sent to the psoc I will always receive back error code 0x03 or "The amount of data available is out of the expected range". Now I'm not sure why this is an issue because I send the correct amount of bytes to meet the size of the flash array size in the device. To go into extreme detail, I send 4 packets containing 57 bytes for the main bulk of the flash row and then the final 28 (256 - 57*4)  bytes with the program row command. If anyone has an idea on what the issue maybe please respond.

Some further details

-I already converting the ascii characters from the cyacd file to hex and those hex values are the bytes being sent

-My buffer size on the uart in psoc creator is 64

- I've tried sending packets with individual bytes and still returned the same error

-The previous steps, enter bootload and get flash size work as intended with the appropriate responses

0 Likes
1 Solution
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello Adam,

I hope the issue is resolved. I'm just posting the summary of the solution.

"The issue stemmed from the ECC data and whether or not to include. Once I added those last bytes, the Psoc responded as intended. "

Thanks,

Hima

View solution in original post

0 Likes
9 Replies
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

Can you please get the exact packet sent. Is it in correct format.

Thanks,

Hima

0 Likes
Anonymous
Not applicable

Certainly,

packet[0] = 0x01; // Start

packet[1] = 0x39; //Program row command

packet[2] = 0x1F; // Data Length lsb (28 bytes of data + 2 bytes of flash row number + 1 byte of flash array ID)

packet[3] = 0x00; // data length msb

packet[4] = 0x00;// flash array ID

packet[5] = 0x27; // starting row in flash array lsb

packet[6] = 0x00; // starting row in flash array msb

packet[7- 33] = data from cyacd file converted from ASCII to hex

packet[34] = checksum lsb 0xF9 (0xFFFF - (0x7F + the checksum summation for bytes 7-33))

packet[35] = checksum msb 0xF8

packet[36] = 0x17

The values for bytes 7-33 are ( the values are the decimal equivalent of what is contained in the byte array)

[7] 74

[8] 17

[9] 112

[10] 27

[11] 9

[12] 1

[13] 50

[14] 19

[15] 112

[16] 68

[17] 34

[18] 3

[19] 75

[20] 26

[21] 112

[22] 112

[23] 71

[24] 207

[25] 1

[26] 0

[27] 73

[28] 110

[29] 88

[30] 0

[31] 64

[32] 118

[33] 88

My specific error code is

1  3  0  0  252(FC)  255(FF)  23(0x17)

0 Likes

Hello,

Can you verify the number bytes being actually send. [7]-[33] is actually 27 bytes as per my understanding. Please correct me if I'm wrong.

Thanks,

Hima

0 Likes
Anonymous
Not applicable

I was only sending 27 bytes of data in the final packet, but even with the updated data length value of 1E(27+3 bytes) I still receive the same error. Please respond as soon as you are able.

-Thanks

Adam Esche

0 Likes

Can you do the following step.

1)Run the Bootloader project in debug mode.

2)Place a break point inside the section "case Bootloader_1_COMMAND_PROGRAM:" in the Bootloader.c file (Bootloader_HostLink())

3)Now you can check the variable "packetBuffer" and check if the PSoC has received the packet exactly as you sent.

Thanks,

Hima

0 Likes
Anonymous
Not applicable

Unfortunately I am not using the code created by cypress and instead using my own c# custom boot loading application. If I continue to have problems with my own code I may need to switch over to what is provided, but for now I wish to continue with my own. Do you believe that the issue maybe bytes being lost during the transit from host to device? If that is the case wouldn't I receive a different error message? The most puzzling issue is that I don't receive any error message while the row data is being sent to the device but only when I send the program row command. Hopefully this info helps you with what the issue may be.

Additional question: Does the format of the data sent to the psoc need to be in hex? For example say you have the value 00 in the cyacd file, should the value that gets passed to the psoc 0x00 or 3030? This might be what is causing the issue but I am unsure.

-Thanks

Adam Esche

0 Likes

Hello,

Do you mean to say that you are not using Bootloader component?

If you are using Bootloader component the data needs to be in hex as mentioned in the Bootloader documentation.

Thanks,

Hima

0 Likes
Anonymous
Not applicable

Sorry for the confusion , I did manage to put a breakpoint on packetBuffer and it did match up with the values what I sent the device. What would suggest my next step be?

-Thanks

Adam Esche

0 Likes
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello Adam,

I hope the issue is resolved. I'm just posting the summary of the solution.

"The issue stemmed from the ECC data and whether or not to include. Once I added those last bytes, the Psoc responded as intended. "

Thanks,

Hima

0 Likes