shinigami35 / arduinouno-ateccx08a Goto Github PK
View Code? Open in Web Editor NEWUse of Microchip Ateccx08a with Arduino Uno
Use of Microchip Ateccx08a with Arduino Uno
Hello, I'm really sorry to bother you again, but I've encountered another issue while using the ATECC devices with the library. I've seen some people addressing this issue as well on the official repository, but none of those managed to find a fix to this.
Everything's working great so far, I can generate random numbers, read zones of different sizes, and every command tried so far works just fine.
However, whenever I try to generate a public key from a private key slot via GenKey command, a weird error happens:
This is the simple code I'm using:
#include <Arduino.h>
#include "ATECCX08A_Arduino/cryptoauthlib.h"
ATCAIfaceCfg cfg;
ATCA_STATUS status;
uint8_t pubkey[64];
void setup()
{
Serial.begin(9600);
cfg.iface_type = ATCA_I2C_IFACE; //I2C mode
cfg.devtype = ATECC608A;
cfg.atcai2c.slave_address = 0X6C; // I2C address 608A = C0, 608B = 6C
cfg.atcai2c.bus = 1;
cfg.atcai2c.baud = 100000;
cfg.wake_delay = 1500; // Delay of wake up (1500 ms)
cfg.rx_retries = 20;
}
//Simple print function. Nothing too fancy
void printArray(uint8_t* array, int size){
for (int i=0; i<size; i++){
Serial.print(array[i]);
}
Serial.println();
}
void loop() {
// put your main code here, to run repeatedly:
status = atcab_init(&cfg);
if (status == ATCA_SUCCESS){
Serial.println("Init ok");
} else {
Serial.print("Init error. Code 0x");
Serial.println(status, HEX);
}
status = atcab_get_pubkey(0, pubkey);
if (status == ATCA_SUCCESS){
Serial.print("PubKey generated from slot 0: ");
printArray(pubkey, 64);
} else {
Serial.print("Genkey failed. Error code 0x");
Serial.println(status, HEX);
}
delay(3000);
}
From my understanding, the code should be ok: no preparations in the TempKey slot are needed in order to generate a public key (but I could also be wrong on this). I also made sure that both chips are good, that slot 0 is storing a private key and is able to generate a public one, in fact I executed the GenKey command with a CryptoAuthentication kit connected via I2C, and everything's working fine.
From what I've read on the official Cryptoauthlib GitHub page, other people encountered this issue on RaspberryPi with I2C (the posts were dated something like 2019), and since other commands are working fine, I would exclude HAL problems and connection problems of any sort.
Yet, I have no idea why this is happening (I mean, that error code sounds definetly weird... Does the chip just wake?); I don't have access to an oscilloscope right now, but I've got no reason to doubt a bad package generation (all the codes and flags in the functions looked good to me) or errors during the transmission process.
Again, sorry if this post is huge, but I wanted to provide as much info as possible. Do you have any idea why this is happening?
Thank you in advance for your time and help.
Hi, I would like to implement the ATECC608 in my security project with Arduino Uno, however, whenever I try to call an atcab function, it will always return error code F0 (Comm_Fail).
I've connected A4 and A5 pins to SDA and SCL pins of the device with a 4.7k pullup resistor.
Sorry if this is some kind of noob question, but I'm totally lost at this point (I've tried almost everything I could think of).
Thank you in advance for your help.
Hi @shinigami35 ..
Thanks for the amazing porting.
I am working with platformio and arduino framework too.
I would like to know if it possible with you modified lib saving data (certificates and keys for aws connection).
Thanks a lot for your help
Hi again @shinigami35 ..
Can you provide here the list of supported secure elements from microchip which are supported from your modified lib?
Thanks a lot
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.