Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Sign Example on Arduino Zero #2

Open
boseji opened this issue Feb 24, 2020 · 8 comments
Open

Problem with Sign Example on Arduino Zero #2

boseji opened this issue Feb 24, 2020 · 8 comments

Comments

@boseji
Copy link

boseji commented Feb 24, 2020

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
Copy link
Member

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
Copy link
Author

boseji commented Feb 25, 2020

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
Copy link

N5066 commented Jul 31, 2020

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
Copy link
Member

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
Copy link

N5066 commented Aug 1, 2020 via email

@Senci86
Copy link

Senci86 commented Nov 21, 2022

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

@m0923678421
Copy link

m0923678421 commented Oct 12, 2023

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.

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

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

@VinayBharambe
Copy link

@m0923678421 Thanks. It solves the problem. BTW I tried it on Arduino DUE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants