How to read from ATSHA204a Data slots?

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello friends,

I am new to ATSHA204a and just want to do simlple operation like reading out the key/information, which I have written to ATSHA.

 

I want to use data slot 0 to data slot 14 for storing read/write data, and slot 15 for storing SecureKey information. 

For the above purpose, I have written 0x0000 to all slotsconfigs (from slotconfig0 to slotconfig14) and 0xA0C0 to slotconfig15 for storing Key. 

 

I have locked Config Zone, but Data Zone & OTP is unlocked.

 

Data is getting written with return Status as ATCA_SUCCESS.

But when I try to read written data in any slot, I get ATCA_EXECUTION_ERROR. 

 

I call my atca read function as following:

atcab_read_zone(ATCA_ZONE_DATA, key_slot, 0, 0, ReadData, 32);

 

where, key_slot is any key id from which I want to read. 

 

 

Please help me regarding this matter. 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kalyanivk wrote:
I have locked Config Zone, but Data Zone & OTP is unlocked.

 

Hi - You can't read the slots unless the data-zone is locked. After that, you may or may not be able to read the slot depending on the configuration. Can you post your slot configurations?

 

"When all else fails, read the directions"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Per the Datasheet:

 

Bit 6 & 7 for the slot configuration determines whether if you can read the key after the data zone is locked:

 

Bit 7 - IsSecret

0 = The slot is not secret and allows clear read, clear write, no MAC check and no Derivekey Command.
1 = The slot is secret. Reads and writes if allowed, must be encrypted.

Bit 6 - EncryptRead

0 = Clear reads are permitted.
1 = Requires the slot to be Secret and encrypted read to access.

Section 8.5.15 of the datasheet discusses what and when a slot can be read:

 

Data

If the Data zone is unlocked, this command returns an error; otherwise, the values within the corresponding SlotConfig word act to control access to the data slot. If SlotConfig.IsSecret is set and a four byte read is attempted, the device returns an error. If EncryptRead is set, this command encrypts the data as specified above. If IsSecret is set and EncryptRead is clear, then this command returns an error. If IsSecret is clear and EncryptRead is clear, then this command returns the desired slot in the clear

 

 

 

"When all else fails, read the directions"