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

Teensy 4.0 and ATECC608 #36

Closed
gannaramu opened this issue Oct 15, 2021 · 1 comment
Closed

Teensy 4.0 and ATECC608 #36

gannaramu opened this issue Oct 15, 2021 · 1 comment

Comments

@gannaramu
Copy link

Hi Team,
I know this library was intended for NINO devices. but I am trying to use it with Teensy4.0. Initially, I faced the below issue

lib\ArduinoECCX08\src\ECCX08.cpp: In member function 'int ECCX08Class::receiveResponse(void*, size_t)':
lib\ArduinoECCX08\src\ECCX08.cpp:724:80: error: call of overloaded 'requestFrom(uint8_t, size_t, bool)' is ambiguous
   while (_wire->requestFrom((uint8_t)_address, (size_t)responseSize, (bool)true) != responseSize && retries--);
                                                                                ^
In file included from C:\Users\ganna\.platformio\packages\framework-arduinoteensy\libraries\Wire/Wire.h:26:0,
                 from lib\ArduinoECCX08\src\ECCX08.h:24,
                 from lib\ArduinoECCX08\src\ECCX08.cpp:22:
C:\Users\ganna\.platformio\packages\framework-arduinoteensy\libraries\Wire/WireIMXRT.h:90:10: note: candidate: uint8_t TwoWire::requestFrom(uint8_t, uint8_t, uint8_t)
  uint8_t requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop);
          ^
C:\Users\ganna\.platformio\packages\framework-arduinoteensy\libraries\Wire/WireIMXRT.h:94:10: note: candidate: uint8_t TwoWire::requestFrom(int, int, int)
  uint8_t requestFrom(int address, int quantity, int sendStop) {
          ^
*** [.pio\build\teensy40\libc4b\ArduinoECCX08\ECCX08.cpp.o] Error 1

which I was able to fix by changing line724

  while (_wire->requestFrom((uint8_t)_address, (size_t)responseSize, (uint8_t)1) != responseSize && retries--);

But the Random number example always returns the same value :

--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
SN: 01234E5F5936FF28EE
Random number = 13312 
Random number = 13312
Random number = 13312

After a little bit of debugging, I realized the wakeup function returns zero after the first instance inside ECCX08.cpp at

int ECCX08Class::random(byte data[], size_t length)
{
if (!wakeup()) {
return 0;
}

Any help is appreciated

@gannaramu
Copy link
Author

The issue was with the Wire library buffer length which is default at 32 . I was able to solve the issue by increasing the default buffer_length to 256

https://github.com/PaulStoffregen/Wire/pull/36/files

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

1 participant