sparkfun / SparkFun_ATECCX08a_Arduino_Library

An Arduino library to use with the Microchip ATECCX08a Cryptographic Co-processors.
https://www.sparkfun.com
Other
36 stars 18 forks source link

Problem with Sign Example on Arduino Zero #2

Open boseji opened 4 years ago

boseji commented 4 years ago

Hello,

I have a spare ATECC508A chip hooked up to a Arduino Zero. While executing the Example2_Sign the output gets stuck in the middle.

Successful wakeUp(). I2C connections are good.

Serial Number:  012370A086A03B82EE
Rev Number:     00005000
Config Zone:    Locked
Data/OTP Zone:  Locked
Data Slot 0:    Locked

uint8_t message[32] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
};

After this It just stalls. For configuration I executed the Example1_Configuration Here is that output:

Successful wakeUp(). I2C connections are good.

Serial Number:  012370A086A03B82EE
Rev Number:     00005000
Config Zone:    Locked
Data/OTP Zone:  Locked
Data Slot 0:    Locked

Would you like to configure your Cryptographic Co-processor with SparkFun Standard settings? (y/n)
***Note, this is PERMANENT and cannot be changed later***
***If you do not want to do this, type an 'n' or unplug now.***

Please help resolve this.

Thanking you,

Regards @boseji

lewispg228 commented 4 years ago

Hi @boseji , Sorry you're having trouble using our library. Thanks for reaching out. I have never used it with an Arduino Zero board, and my first guess is that it's an I2C buffer length problem.

If configuration is working, then I'm assuming that most I2C communications are working properly. Do you happen to know what the I2C buffer length is when using that board? It needs to be at least 128 bytes, and so the standard Wire library for most Arduinos is 32 Bytes, and this needs to be modified in the wire.h header file.

For reference, we have verified this library on SamD boards and the SparkFun Artemis (Apollo 3), and these do not require any modification to the buffer length. If you have another Arduino with either of these architectures, that would be a good test (as a point of reference).

Also, what exact model of the Arduino Zero are you using?

Let us know and thanks again for reaching out, -Pete

boseji commented 4 years ago

Hi Pete,

Thanks for your reply.

Arduino Zero is the first SAMD board: https://store.arduino.cc/usa/arduino-zero

I am using the Programming USB port on this board with the same variant selected.

Here is the Ring Buffer size being used: https://github.com/arduino/ArduinoCore-samd/blob/1.8.4/libraries/Wire/Wire.h#L74

This is the SAMD official core I am using at release version 1.8.4. Since this is an official SAMD and Sparkfun library supports SAMD, so I went for this board. Unfortunately I don't have an Artemis board to verify.

I am also having a ESP32 board : https://docs.zerynth.com/latest/official/board.zerynth.doit_esp32/docs/index.html

If you wish for checking, I can change the following line: https://github.com/sparkfun/SparkFun_ATECCX08a_Arduino_Library/blob/master/src/SparkFun_ATECCX08a_Arduino_Library.h#L94

To use Serial like Apolo3. Then we can have a 1:1 compare.

ESP32 Core release '1.0.4` supports 128 bytes: https://github.com/espressif/arduino-esp32/blob/1.0.4/libraries/Wire/src/Wire.h#L34

Please let me know.

Warm Regards, @boseji

N5066 commented 4 years ago

Hey! I have tried to use this library on Arduino IDE to use it with Arduino UNO...But when I compiled the Configuration Example there was an error :

Example1_Configuration:37: error: call to 'boolean ATECCX08A::begin(uint8_t, TwoWire&, Stream&)' uses the default argument for parameter 3, which is not yet defined

if (atecc.begin() == true)

               ^

call to 'boolean ATECCX08A:: begin (uint8_t, TwoWire&, Stream&)' uses the default argument for parameter 3, which is not yet defined

Looking forward to your reply

lewispg228 commented 4 years ago

Hey @N5066 , As you've experienced, this library is not yet supported on the Uno. If you want to attempt to get it working, then you'll need to adjust some of the source files to correctly handle Serial, and also adjust the Wire.h file to have a larger I2C buffer.

I was actually working on this last week, but wasn't able to get it to work on an Uno. I haven't looked at what's happening with a logic analyzer yet, but hopefully I can find some time next week to dig into this further.

I'll keep you posted, and good luck!

N5066 commented 4 years ago

Thanks for your reply... Though I will be trying myself yet I will be waiting for your mail when you will make changes in the library...

On Fri, 31 Jul, 2020, 8:02 PM Pete Lewis, notifications@github.com wrote:

Hey @N5066 https://github.com/N5066 , As you've experienced, this library is not yet supported on the Uno. If you want to attempt to get it working, then you'll need to adjust some of the source files to correctly handle Serial, and also adjust the Wire.h file to have a larger I2C buffer.

I was actually working on this last week, but wasn't able to get it to work on an Uno. I haven't looked at what's happening with a logic analyzer yet, but hopefully I can find some time next week to dig into this further.

I'll keep you posted, and good luck!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sparkfun/SparkFun_ATECCX08a_Arduino_Library/issues/2#issuecomment-667150550, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQOXH7TUNGCIB4APTW24PD3R6LIXXANCNFSM4K2ASIGA .

Senci86 commented 1 year ago

is there any solution for the Uno since 2 years ago ;)?

m0923678421 commented 1 year ago

It's work on MEGA2560. UNO's memory is not enough.

I meet this problem several years ago with Funduino Colorduino. https://youtu.be/QuG5agVdF58 I2C buffer size is not enough to package command.

Some libraries need to be change.

1. wire.h location : C:\Users\"you pc name"\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.4\libraries\Wire\src\Wire.h

#define BUFFER_LENGTH 32

32 change to 160

#define BUFFER_LENGTH 160

2. twi.h location : C:\Users\"you pc name"\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.4\libraries\Wire\src\utility\twi.h

#define TWI_BUFFER_LENGTH 32

32 change to 160

#define TWI_BUFFER_LENGTH 160