MicrochipTech / cryptoauthlib

Library for interacting with the Crypto Authentication secure elements
Other
367 stars 217 forks source link

ATECC608A always returns wakeup frame and fails in calib_read_zone function (ret = 0x0000F3) #246

Open victorK8 opened 3 years ago

victorK8 commented 3 years ago

Host MCU: Microchip wlr089 (sam0 microchip) Chip: ATECC608A in 88CKSCKT Xplained Pro Interface : I2C Bus Issue:

When I tried to init the cryptoauth library, it returned calib_read_zone error (Failed with ret = 0x0000F3).

Also, I tried to get a random number. However, it showed the same error.

By debugging, I checked that hal_i2c_received function got always the same frame (0x4 0x11 0x33 0x43). This frame equals with wake-up frame thath atecc608 returns. Moreover, ret = 0x0000F3 seems to be ATCA_WAKE_SUCCESS in cryptoauthlib status codes.

Any idea @bryan-hunt ?

Thanks!

bryan-hunt commented 2 years ago

So we ended up locating the root cause for this issue so I'm updating the ticket with the findings so those that may encounter will see this comment. The basic issue is that the error code is misleading - the failure is that the hal is unable to access/use the underlying driver functions for the configured peripheral.

This failure is occurring during the wake step which only returns wake failure (misnomer for the error code) and it masks the hal api failure. This means that the investigation for resolution is always into the HAL regardless of which one is being used. For example on linux it almost always means the hal is unable to open the device file.

I'm looking at options to propagate different error codes depending on the condition when it's an obvious hal failure rather than simply a non responsive part. For that reason I'm not closing this issue since I expect us to release something in the next version that makes diagnosing these issues more straightforward.