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

Compile error #3

Closed
kylix34 opened this issue Nov 23, 2019 · 20 comments
Closed

Compile error #3

kylix34 opened this issue Nov 23, 2019 · 20 comments

Comments

@kylix34
Copy link

kylix34 commented Nov 23, 2019

I get this error when trying to compile the code for Arduino Uno:

Arduino: 1.8.10 (Windows 7), Board: "Arduino/Genuino Uno"
.....................
C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp: In function 'int16_t FCP_Get_OptData_Length(char*, uint8_t*, uint8_t, const uint8_t*, const char*)':

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp:57:20: error: aggregate 'FCP_Get_OptData_Length(char*, uint8_t*, uint8_t, const uint8_t*, const char*)::AES_ctx ctx' has incomplete type and cannot be defined

 struct AES_ctx ctx;

                ^

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp:58:27: error: 'AES_init_ctx' was not declared in this scope

 AES_init_ctx(&ctx, key);

                       ^

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp:61:50: error: 'AES_ECB_decrypt' was not declared in this scope

   AES_ECB_decrypt(&ctx, encSection + (i * 16));

                                              ^

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp: In function 'int16_t FCP_Get_OptData(char*, uint8_t*, uint8_t, uint8_t*, const uint8_t*, const char*)':

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp:146:20: error: aggregate 'FCP_Get_OptData(char*, uint8_t*, uint8_t, uint8_t*, const uint8_t*, const char*)::AES_ctx ctx' has incomplete type and cannot be defined

 struct AES_ctx ctx;

                ^

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp:147:27: error: 'AES_init_ctx' was not declared in this scope

 AES_init_ctx(&ctx, key);

                       ^

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp:150:50: error: 'AES_ECB_decrypt' was not declared in this scope

   AES_ECB_decrypt(&ctx, encSection + (i * 16));

                                              ^

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp: In function 'int16_t FCP_Encode(uint8_t*, char*, uint8_t, uint8_t, uint8_t*, const uint8_t*, const char*)':

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp:255:20: error: aggregate 'FCP_Encode(uint8_t*, char*, uint8_t, uint8_t, uint8_t*, const uint8_t*, const char*)::AES_ctx ctx' has incomplete type and cannot be defined

 struct AES_ctx ctx;

                ^

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp:256:27: error: 'AES_init_ctx' was not declared in this scope

 AES_init_ctx(&ctx, key);

                       ^

C:\Program Files (x86)\Arduino\libraries\FOSSA-Comms\src\FOSSA-Comms.cpp:259:50: error: 'AES_ECB_encrypt' was not declared in this scope

   AES_ECB_encrypt(&ctx, encSection + (i * 16));

                                              ^

Multiple libraries were found for "SPI.h"
Used: C:\Program
Multiple libraries were found for "SoftwareSerial.h"
Used: C:\Program
Multiple libraries were found for "FOSSA-Comms.h"
Used: C:\Program
Multiple libraries were found for "aes.h"
Used: C:\Program
Multiple libraries were found for "RadioLib.h"
Used: C:\Program
Using library FOSSA-Comms at version 1.0.0 in folder: C:\Program Files
Using library AESLib in folder: C:\Program Files
Using library RadioLib at version 1.8.0 in folder: C:\Program Files
Using library SPI at version 1.0 in folder: C:\Program Files
Using library SoftwareSerial at version 1.0 in folder: C:\Program Files
exit status 1
Error compiling for board Arduino/Genuino Uno.

@kylix34 kylix34 changed the title Compilation error Compile error Nov 23, 2019
@jgromes
Copy link
Contributor

jgromes commented Nov 23, 2019

You seem to have loads of conflicting libraries - including core Arduino libraries like SoftwareSerial and SPI. I suggest you reinstall your Arduino IDE and only install each library once.

Also, which AES library are you using?

@kylix34
Copy link
Author

kylix34 commented Nov 23, 2019

I got the AES library from here: https://github.com/DavyLandman/AESLib
Strange, I searched my HDD for Fossa-Comms.h and it didn't find another copy...
Anyway, it's using the libraries from he correct folder.

@K4KDR
Copy link

K4KDR commented Nov 23, 2019

I was getting similar errors (even though library setup 'looked' fine) and can confirm that removing Arduino IDE app + delete "Sketchbook location" folder (which includes /libraries folder) and reinstalling allowed me to compile without errors.

Library installation after IDE reinstall on linux was:

cd ~/Arduino/libraries/
git clone https://github.com/DavyLandman/AESLib.git
git clone https://github.com/jgromes/RadioLib.git
git clone https://github.com/FOSSASystems/FOSSA-Comms.git
git clone https://github.com/FOSSASystems/tiny-AES-c.git

-Scott, K4KDR

@kylix34
Copy link
Author

kylix34 commented Nov 23, 2019

Thanks Jan/Scott! I'll try on another PC and update this topic.

@jgromes
Copy link
Contributor

jgromes commented Nov 23, 2019

@kylix34 I updated this library a few hours ago, to use tiny-AES-c instead of AESLib, since AESLib only works on AVR microcontrollers and some people are using ESP32 boards for their ground stations. You basically have two options:

  1. Using FOSSA-Comms release 1.0.0, which uses AESLib. This will only work on AVR Arduino boards.
  2. Using the latest FOSSA-Comms from the repository, which uses our fork of tiny-AES-c. this will work on almost all platforms.

-Jan

@kylix34
Copy link
Author

kylix34 commented Nov 23, 2019

It all went smooth once I changed the AES library to tiny-AES-c
I have one error in the serial window: Initializing.......failed, code -705. I have to see what this -705 initializing code means

@kylix34 kylix34 closed this as completed Nov 23, 2019
@jgromes
Copy link
Contributor

jgromes commented Nov 23, 2019

-705 is ERR_SPI_CMD_TIMEOUT - it means that there was a timeout during SPI communication with the SX126x module. I suggest you check the wiring and module type.

@kylix34
Copy link
Author

kylix34 commented Nov 23, 2019

I have the DRF1268T module and this shield: https://www.tindie.com/products/dorji_com/sx1268-sx1262-testing-kit-for-arduino-st-nucleo/
It could be that the pins are routed differently than set in the sketch.

PS: I changed the pins in the sketch:

// SX1268 has the following connections:
// NSS pin: 7
// DIO1 pin: 5
// DIO2 pin: 4
// BUSY pin: 3
SX1268 radio = new Module(7, 5, 4, 3);

but now I get error code -20 (ERR_WRONG_MODEM) and the second time I try, the code is -707 (ERR_SPI_CMD_FAILED)

@kylix34
Copy link
Author

kylix34 commented Nov 23, 2019

The pin definitions are correct now but I get those error codes :(

@jgromes
Copy link
Contributor

jgromes commented Nov 23, 2019

That could suggest a damaged module. You could try few things:

  1. Remove the while(true); loop that stops further program execution if radio.begin() returns an error. It will force the program to continue despite the error code - not sure what will happen there.
  2. If the shield has NRESET connection, you could try to manually reset the module before radio.begin() using the following code:
pinMode(NRESET, OUTPUT);
digitalWrite(NRESET, LOW);
delayMicroseconds(100);
digitalWrite(NRESET, HIGH);

EDIT: also, I noticed the shield you're using has DIO1 and DIO2 connected to Arduino pins 5 and 4, which do not support external interrupts - because of that, you won't be able to use interrupt-driven reception.

@kylix34
Copy link
Author

kylix34 commented Nov 23, 2019

I tried option 2 and now I only get error code -707 ... Arghhhhh

@jgromes
Copy link
Contributor

jgromes commented Nov 24, 2019

What happens when yo try option 1 - ignoring the error code? Alternatively, you could try with a different module, be it SX127x or SX126x.

-707 is ERR_SPI_CMD_FAILED - anything from -705 to -707 suggests the SPI communication is not working correctly.

@kylix34
Copy link
Author

kylix34 commented Nov 24, 2019 via email

@kylix34
Copy link
Author

kylix34 commented Nov 24, 2019

I removed the shield and connected it through dupont wires, using the correct pins on Arduino. It still doesn't recognize the module.
I also tried removing the while (true); statement and I get this:
"Transmitting packet ...
0x46 F
0x4F O
0x53 S
0x53 S
0x41 A
0x53 S
0x41 A
0x54 T
0x2D -
0x31 1
0x3 �
Waiting for response ...
"
This doesn't mean anything (I'm using the GetSystemInfo sketch)

@jgromes
Copy link
Contributor

jgromes commented Nov 24, 2019

I've seen this problem pop up from time to time on one of my SX1268 modules - initially, the module returned -707 but subsequent commands were OK. I still don't know what's causing this, as it's only happening sometimes on one of the modules and only after power cycle. I asked Semtech about it, no response yet.

@kylix34
Copy link
Author

kylix34 commented Nov 24, 2019 via email

@jgromes
Copy link
Contributor

jgromes commented Nov 24, 2019

I don't think the module is broken completely, it seems to transmit just fine - I think you will be able to use it. You could try running one of RadioLib SX126x examples with debug mode enabled to get some more information about the issue.

The one module that was giving me a similar problem was SX1268 too, but since I don't know what is the actual issue, I can't say if SX1262 will work better. On a side note, resetting a few times or unplugging the Arduino and connecting it back has solved the issue for me.

@kylix34
Copy link
Author

kylix34 commented Nov 24, 2019 via email

@jgromes
Copy link
Contributor

jgromes commented Nov 24, 2019

Did you try it in debug mode? Open RadioLib/src/TypeDef.h, uncommentd #define RADIOLIB_DEBUG and #define RADIOLIB_VERBOSE and upload.

This seems to be unrelated to this library. Could you please open a new issue in RadioLib?

@kylix34
Copy link
Author

kylix34 commented Nov 24, 2019 via email

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

3 participants