ADXL345 motion sensor compile failed

Question/Issue:
ADXL345 motion sensor compile failed

Project ID:
521221

Context/Use case:
use adxl345 sensor to generate on/off signal, deployed as arduino library. when i integrate the library to seeedstudio XIAO-esp32s3 board. It fails to compile.

Steps Taken:

  1. use adxl345 to generate x,y,z data and upload 2 data sets(on and off) to edge impulse
  2. train
  3. deploy

Expected Outcome:
Arduino ide compile correctly and can use the adxl345 to generate on and off signal

Actual Outcome:
compile failed

Reproducibility:

  • [X ] Always
  • [ ] Sometimes
  • [ ] Rarely

Environment:

  • Platform: [Xiao-ESP32S3.]

  • Build Environment Details: Arduino IDE 2.3.2]

  • OS Version: [Windows 10]

  • Edge Impulse Version (Firmware):
    #define EI_STUDIO_VERSION_MAJOR 1
    #define EI_STUDIO_VERSION_MINOR 58
    #define EI_STUDIO_VERSION_PATCH 0

  • Edge Impulse CLI Version:
    Edge Impulse data forwarder v1.27.1

  • Project Version: [e.g., 1.0.0]

  • Custom Blocks / Impulse Configuration: [Describe custom blocks used or impulse configuration]

Logs/Attachments:
[Include any logs or screenshots that may help in diagnosing the issue]

c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp: In function ‘TfLiteStatus tflite::{anonymous}::Prepare(TfLiteContext*, TfLiteNode*)’:
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1789:67: error: either all initializer clauses should be designated or none of them should be
1789 | .channels = input->dims->data[3], 1
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1793:68: error: either all initializer clauses should be designated or none of them should be
1793 | .channels = output->dims->data[3], 1
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1795:80: error: either all initializer clauses should be designated or none of them should be
1795 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp: In function ‘void tflite::{anonymous}::EvalQuantizedPerChannel(TfLiteContext*, TfLiteNode*, const TfLiteConvParams&, const NodeData&, const TfLiteEvalTensor*, const TfLiteEvalTensor*, const TfLiteEvalTensor*, TfLiteEvalTensor*)’:
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1883:58: error: either all initializer clauses should be designated or none of them should be
1883 | .channels = input_depth, 1
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1887:59: error: either all initializer clauses should be designated or none of them should be
1887 | .channels = output_depth, 1
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1889:80: error: either all initializer clauses should be designated or none of them should be
1889 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp: In function ‘void tflite::{anonymous}::EvalQuantizedPerChannel(TfLiteContext*, TfLiteNode*, const TfLiteDepthwiseConvParams&, const NodeData&, const TfLiteEvalTensor*, const TfLiteEvalTensor*, const TfLiteEvalTensor*, TfLiteEvalTensor*)’:
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1727:58: error: either all initializer clauses should be designated or none of them should be
1727 | .channels = input_depth, 1
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1731:59: error: either all initializer clauses should be designated or none of them should be
1731 | .channels = output_depth, 1
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1733:80: error: either all initializer clauses should be designated or none of them should be
1733 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp: In function ‘TfLiteStatus tflite::{anonymous}::Prepare(TfLiteContext*, TfLiteNode*)’:
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1836:67: error: either all initializer clauses should be designated or none of them should be
1836 | .channels = input->dims->data[3], 1
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1840:68: error: either all initializer clauses should be designated or none of them should be
1840 | .channels = output->dims->data[3], 1
| ^
c:\Users\Emma\Documents\Arduino\libraries\imu_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1842:80: error: either all initializer clauses should be designated or none of them should be
1842 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^

exit status 1

Compilation error: exit status 1

Additional Information:
[Any other information that might be relevant]

arduino code: https://raw.githubusercontent.com/xyu6/edgeimpluse-motion/refs/heads/main/xiao%20esp32s3%20adxl345_sense_accelerometer.ino

Hi @yuxuezeng

See the similar issue here, this seems to have worked for the other user :smiley: - ESP 32 cam, Compilation Error - #5 by Eoin

Please see the ESP32 guide for information on using them as an Arduino library:

Best

Eoin

the issue is solved by following https://www.hackster.io/mjrobot/exploring-machine-learning-with-the-new-xiao-esp32s3-6463e5

To do that, locate ei_classifier_config.h in exported Arduino library folder: /scr/edge-impulse-sdk/classifier/

Locate the line with #define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 1 , and change it from 1 to 0

1 Like

Thanks @yuxuezeng for sharing!