How to Send Fermware(.hex) checksum to UART?

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

cross mob
Anonymous
Not applicable

In most time I have more than 2 boards(pcb). Each board containing one PSoC. I want to know perticular software version running on perticular board (pcb). I think best way is to read checksum and dump through UART. If the checksum is of old pogram then only I update PSoC. If there will be some modification in program file checksum will be automatically changed.

   

I want to know :

   

1. how to read checksum in main.c so that I dump it through UART?

   

2. Is there any better solution to keep tag software version info on PSoC?

0 Likes
15 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

1. how to read checksum in main.c so that I dump it through UART?

   

 

   

You could calc checksum of program memory with a simple utility.    

   

          http://www.geeksengine.com/article/checksum.html

   

 

   

2. Is there any better solution to keep tag software version info on PSoC?

   

 

   

Yes, burn a version number into EEPROM by using EEPROM component.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

@ Dana,

   

 Pls correct me if any mistake. 

   

 1. how to read checksum in main.c so that I dump it through UART?

   

Yes checksum may be calculated for every modification using given utility. But it will be manullay updated in main.c every time.

   

 

   

2. Is there any better solution to keep tag software version info on PSoC?

   

 

   

Yes, EEPROM may be a good option but this is useful in case of final release. Also I think you need to update version info manullay in EEPROM. (Some time it may happen I forgot to update version. That's why I think checksum may be good and it will automatically update whenever changes happen)

   

 

   

Regards, Pratik

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

With 2) this does not have to be manual, everytime main() starts up

   

run chksum utility and write EEPROM to update. In fact you could collect

   

a history inside EEPROM automatically.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

This is interesting. Can you provide some more info about this?

   

Regards, Pratik

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Home page Creator, "Find Example Projects", there is a project for using

   

EEPROM.

   

 

   

Basically call the checksum routine each time you start up, and then look

   

at EEPROM to see if its the same, if not use a ptr stored in flash and write

   

to that location, of just scan EEPROM area used for this purpose for first

   

blank entry.

   

 

   

You could use RTC to date/time stamp the entry in EEPROM.

   

 

   

Use a structure for use in your writes to EEPROM, eg, new checksum, ptr

   

update, date, time etc..

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

I don't understand about checksum routine.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I was referring to your original post thats how you determine

   

SW version.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

I think PSoC creator already generates checksum for every hex file . That's why PSoC progrommer shows checksum for hex file.

   

Is there any method to read this checksum in main.c instead of using utility in main?

0 Likes
Anonymous
Not applicable

Nerver tried that but there are information about the checksum of PSOc

   

1. On section 3 of the psoc5 device programming manual. There are information of the checksum validation of the PSOC5.

   

2.Section 44 nonvolatile memory programming of PSoC 5 TRM does some information as well.

0 Likes
Anonymous
Not applicable

@ H L

   

As I understand from PSoC® 5 Device Programming Specifications.

   

Target device (i.e. PSoC) has checksum at data register address = 32’h40004720, data = lower 2 bytes.

   

I tried to read this data register in main using : 

   

uint32 check = CY_GET_REG32(0x40004720);

   

and I got check = 131072.

   

but checksum form PSoC programmer (for PSoC) = 0xC321.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

If the checksum is lower 2 bytes, a 16 bit checksum, then when you

   

read 32 bit register you need to mask off upper 16 bits ?

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 @ Dana

   

uint32 131072 = 0x20000

   

lower 16 bit = 0x0000.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Did the checksum get calculated ?

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 @ Dana

   

No, lower 16 bit is not matched to actual checksum.

0 Likes
Anonymous
Not applicable

 Actually programming PSoC with different hex file does not change lower 16 bit of data register ( data = 0x0000).

0 Likes