Closed Fehmi-Karaal closed 1 year ago
Hello @Fehmi-Karaal , which MCU board are you using with this sensor? It seems that your core does not support the TwoWire constructor. Anyway, according your hardware setup, you can try to pass directly the Wire instance and see if it works on your side. Best Regards, Carlo
Esp32
Get Outlook for iOShttps://aka.ms/o0ukef
From: Carlo Parata @.> Sent: Wednesday, March 1, 2023 3:09:41 AM To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , which MCU board are you using with this sensor? It seems that your core does not support the TwoWire constructor. Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1449528007, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWSBTLYPAAVGINSMV6DWZ374LANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
Hello @Fehmi-Karaal , if you check here, you will see that ESP32 does not support the Wire constructor above. So, I suggest to use one of the available Wire instances and then set SDA and SCL pins according your needs. So you can try something like:
Wire.setPins(I2C_SDA, I2C_SCL);
Wire.begin();
LSM6DSV16XSensor AccGyr(&Wire);
AccGyr.begin();
AccGyr.Enable_X();
AccGyr.Enable_G();
Best Regards, Carlo
Hello @Fehmi-Karaal , any update on this topic? Best Regards, Carlo
It looks worked. When set I2C pins I did not take the error but I have not tested it on physical sensor yet. I’ll keep you updated. Thank you for following this
Regards, Fehmi
Get Outlook for iOShttps://aka.ms/o0ukef
From: Carlo Parata @.> Sent: Tuesday, March 7, 2023 4:59:15 AM To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , any update on this topic? Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1457880486, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWRQGPFFW2TW4AKUNLTW24BHHANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
Ok, meantime we can close this issue. Best Regards, Carlo
Hi Carlo,
I can successfully upload the code to ESP32 after applying your suggestion. However, I still have an I2C communication error. I used STEVAL-MKI227KA evaluation kit and connected SCL SDA to ESP32's SCL and SDA pins. VD and VDDIO to 3v pin in ESP32 and GND to GND.
Do you have any suggestions?
Thank you, Fehmi Karaalioglu
From: Carlo Parata @.> Sent: March 7, 2023 05:25 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Closed #7https://github.com/stm32duino/LSM6DSV16X/issues/7 as completed.
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#event-8684078026, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWXGBAH2HCIRWKHCYZDW24EIVANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
Hello @Fehmi-Karaal , you must connect also SDO/SA0 pin. You can choose to connect this pin to VDD and in this case you must use as I2C address LSM6DSV16X_I2C_ADD_H or you can connect this pin to GND and in this case you must use as I2C address LSM6DSV16X_I2C_ADD_L. Let me know if this hint fixes your issue. Best Regards, Carlo
.... Thank you so much. the hint fixed the issue when I connected SDO/SA0 to LSM6DSV16X_I2C_ADD_H. However, the output values are only 0. The code and output are below.
LSM6DSV16XSensor sensor (&Wire); int32_t accel[3], angrate[3];
void setup() { Wire.setPins(I2C_SDA, I2C_SCL); Wire.begin(); Serial.begin(115200); sensor.begin(); sensor.Enable_X(); sensor.Enable_G(); }
void loop() { sensor.Get_X_Axes(accel); sensor.Get_G_Axes(angrate);
Serial.print("Accel-X[mg]:"); Serial.print(accel[0], 2); Serial.print(",Accel-Y[mg]:"); Serial.print(accel[0], 2); Serial.print(",Accel-Z[mg]:"); Serial.print(accel[0], 2);
Serial.print(",AngRate-X[mdps]:"); Serial.println(angrate[0], 2); Serial.print(",AngRate-Y[mdps]:"); Serial.println(angrate[1], 2); Serial.print(",AngRate-Z[mdps]:"); Serial.println(angrate[2], 2);
delay(500); }
[cid:76d1c4ca-03ee-424c-b437-c9f9f515194d]
Thank you, Fehmi Karaalioglu
From: Carlo Parata @.> Sent: March 17, 2023 11:40 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , you must connect also SDO/SA0 pin. You can choose to connect this pin to VDD and in this case you must use as I2C address LSM6DSV16X_I2C_ADD_H or you can connect this pin to GND and in this case you must use as I2C address LSM6DSV16X_I2C_ADD_L. Let me know if this hint fixes your issue. Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1474029780, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWWMHYERRPR5JXVXB2TW4SAVHANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
... I restarted. Now, it works well. I just need to convert from binary to decimal.
Thank you, Fehmi Karaalioglu
From: Fehmi Karaalioglu @.> Sent: March 17, 2023 12:43 To: stm32duino/LSM6DSV16X @.>; stm32duino/LSM6DSV16X @.> Cc: Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
.... Thank you so much. the hint fixed the issue when I connected SDO/SA0 to LSM6DSV16X_I2C_ADD_H. However, the output values are only 0. The code and output are below.
LSM6DSV16XSensor sensor (&Wire); int32_t accel[3], angrate[3];
void setup() { Wire.setPins(I2C_SDA, I2C_SCL); Wire.begin(); Serial.begin(115200); sensor.begin(); sensor.Enable_X(); sensor.Enable_G(); }
void loop() { sensor.Get_X_Axes(accel); sensor.Get_G_Axes(angrate);
Serial.print("Accel-X[mg]:"); Serial.print(accel[0], 2); Serial.print(",Accel-Y[mg]:"); Serial.print(accel[0], 2); Serial.print(",Accel-Z[mg]:"); Serial.print(accel[0], 2);
Serial.print(",AngRate-X[mdps]:"); Serial.println(angrate[0], 2); Serial.print(",AngRate-Y[mdps]:"); Serial.println(angrate[1], 2); Serial.print(",AngRate-Z[mdps]:"); Serial.println(angrate[2], 2);
delay(500); }
[cid:76d1c4ca-03ee-424c-b437-c9f9f515194d]
Thank you, Fehmi Karaalioglu
From: Carlo Parata @.> Sent: March 17, 2023 11:40 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , you must connect also SDO/SA0 pin. You can choose to connect this pin to VDD and in this case you must use as I2C address LSM6DSV16X_I2C_ADD_H or you can connect this pin to GND and in this case you must use as I2C address LSM6DSV16X_I2C_ADD_L. Let me know if this hint fixes your issue. Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1474029780, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWWMHYERRPR5JXVXB2TW4SAVHANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
Hello Carlo,
First of all, thank you for your contributions.
I could not find the method for accessing the Machine learning core in the source codes and examples. Could you give me some tips on how can I access the machine learning core features provided by the LSM6DSV16X Inertial Measurement Unit (IMU)? I have found a similar application on LSM6DSOX but the implementation details are not publicly available in the documentation. (https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-imu-advanced)
Best Regards, Fehmi Karaalioglu
Hello @Fehmi-Karaal , basically there are not differences in the usage of the MLC for LSM6DSOX and the LSM6DSV16X. You just need to load the correct bytecode for the LSM6DSV16X. You can find some examples of bytecode for the LSM6DSV16X here. In particular if you want to test the activity recognition example you can use this bytecode. The way to load the bytecode of the sensor is the same for LSM6DSOX and LSM6DSV16X. Take into account that the bytecode that I linked configures the interrupt on INT1 pin as described in the README file. So, please pay attention to connect this pin to your MCU and configure it in interrupt mode. Best Regards, Carlo
Thank you so much for the clarification. I just wanted to know what "Get_MLC_Output/Status" methods include.[cid:69712e45-8da1-49b5-aefd-c276f4d5f740]
Kindly, Fehmi Karaalioglu
From: Carlo Parata @.> Sent: June 7, 2023 16:30 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , basically there are not differences in the usage of the MLC for LSM6DSOX and the LSM6DSV16X. You just need to load the correct bytecode for the LSM6DSV16X. You can find some examples of bytecode for the LSM6DSV16X herehttps://github.com/STMicroelectronics/STMems_Machine_Learning_Core/tree/master/application_examples/lsm6dsv16x. In particular if you want to test the activity recognition example you can use this bytecodehttps://github.com/STMicroelectronics/STMems_Machine_Learning_Core/blob/master/application_examples/lsm6dsv16x/activity_recognition_for_mobile/lsm6dsv16x_activity_recognition_for_mobile.h. The way to load the bytecode of the sensor is the same for LSM6DSOX and LSM6DSV16X. Take into account that the bytecode that I linked configures the interrupt on INT1 pin as described in the README filehttps://github.com/STMicroelectronics/STMems_Machine_Learning_Core/tree/master/application_examples/lsm6dsv16x/activity_recognition_for_mobile. So, please pay attention to connect this pin to your MCU and configure it in interrupt mode. Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1581465912, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWT4OVX6S7ZGWRJTA5LXKDQHHANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
Hello @Fehmi-Karaal , you are right, these methods are missed today in the library. I will try to add them. Best Regards, Carlo
Hi @Fehmi-Karaal , I added the missing APIs for MLC. Let me know if now you are able to run an MLC example without issues. Best Regards, Carlo
Hi Carlo, Thank you for adding the missing part. I have two issues because of data types as follows in the screenshot.
[cid:756cd97e-927c-4e50-98fd-4e5fd311b7bf]
Thank you, Fehmi Karaalioglu
From: Carlo Parata @.> Sent: June 8, 2023 06:10 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hi @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , I added the missing APIs for MLC. Let me know if now you are able to run an MLC example without issues. Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1582293541, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWQRROHVYUYP4P3IQALXKGQKLANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
Hello @Fehmi-Karaal , unfortunately, I cannot see the screenshot. Which kind of issue do you have on the data types? Best Regards, Carlo
...I pasted the error messages. [{ "resource": "/c:/Users/karaa/Documents/PlatformIO/Projects/walker/src/main.cpp", "owner": "cpp", "severity": 8, "message": "no matching function for call to 'LSM6DSV16XSensor::Get_MLC_Output(uint8_t [8])'", "startLineNumber": 122, "startColumn": 32, "endLineNumber": 122, "endColumn": 32 }]
cannot convert 'lsm6dsv16x_mlc_out_t' to 'uint8_t' {aka 'unsigned char'}
From: Carlo Parata @.> Sent: June 8, 2023 13:08 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , unfortunately, I cannot see the screenshot. Which kind of issue do you have on the data types? Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1583043300, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWVLKWZGU6I3YCZLIQDXKIBHTANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
and I attached the ss.
From: Fehmi Karaalioglu @.> Sent: June 8, 2023 13:10 To: stm32duino/LSM6DSV16X @.>; stm32duino/LSM6DSV16X @.> Cc: Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
...I pasted the error messages. [{ "resource": "/c:/Users/karaa/Documents/PlatformIO/Projects/walker/src/main.cpp", "owner": "cpp", "severity": 8, "message": "no matching function for call to 'LSM6DSV16XSensor::Get_MLC_Output(uint8_t [8])'", "startLineNumber": 122, "startColumn": 32, "endLineNumber": 122, "endColumn": 32 }]
cannot convert 'lsm6dsv16x_mlc_out_t' to 'uint8_t' {aka 'unsigned char'}
From: Carlo Parata @.> Sent: June 8, 2023 13:08 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , unfortunately, I cannot see the screenshot. Which kind of issue do you have on the data types? Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1583043300, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWVLKWZGU6I3YCZLIQDXKIBHTANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
To be more clear, What is the datatype of 'Get_MLC_Output' and 'Get_MLC_Status'. I tried both 'lsm6dsv16x_mlc_status_mainpage_t' and 'lsm6dsv16x_mlc_out_t ' AND uint8_t, but it gives following error:
[{ cannot convert 'lsm6dsv16x_mlc_out_t' to 'uint8_t' {aka 'unsigned char'} }]
From: Fehmi Karaalioglu @.> Sent: June 8, 2023 13:11 To: stm32duino/LSM6DSV16X @.>; stm32duino/LSM6DSV16X @.> Cc: Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
and I attached the ss.
From: Fehmi Karaalioglu @.> Sent: June 8, 2023 13:10 To: stm32duino/LSM6DSV16X @.>; stm32duino/LSM6DSV16X @.> Cc: Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
...I pasted the error messages. [{ "resource": "/c:/Users/karaa/Documents/PlatformIO/Projects/walker/src/main.cpp", "owner": "cpp", "severity": 8, "message": "no matching function for call to 'LSM6DSV16XSensor::Get_MLC_Output(uint8_t [8])'", "startLineNumber": 122, "startColumn": 32, "endLineNumber": 122, "endColumn": 32 }]
cannot convert 'lsm6dsv16x_mlc_out_t' to 'uint8_t' {aka 'unsigned char'}
From: Carlo Parata @.> Sent: June 8, 2023 13:08 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , unfortunately, I cannot see the screenshot. Which kind of issue do you have on the data types? Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1583043300, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWVLKWZGU6I3YCZLIQDXKIBHTANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
Hello @Fehmi-Karaal , with respect to the example of MLC for LSM6DSOX, for LSM6DSV16X you must use the structures defined in the APIs. If you can share also the sketch that you are using, I can help you with the modifications that should be done. Best Regards, Carlo
/**
*/ //NOTE: This example isn't compatible with Arduino Uno. //NOTE: For this example you need the STEVAL-MKI197V1 board connected to the DIL24 connector of the X-NUCLEO-IKS01A3
// Includes
//Interrupts. volatile int mems_event = 0;
LSM6DSV16XSensor sensor (&Wire); int32_t accel[3], angrate[3];
// MLC ucf_line_t *ProgramPointer; int32_t LineCounter; int32_t TotalNumberOfLine;
void INT1Event_cb(); void printMLCStatus(uint8_t status);
void setup() { uint8_t mlc_out[8]; // Led. pinMode(LED_BUILTIN, OUTPUT);
// Force INT1 of LSM6DSOX low in order to enable I2C pinMode(INT_1, OUTPUT);
digitalWrite(INT_1, LOW);
delay(200);
// Initialize serial for output. Serial.begin(115200); Wire.setPins(I2C_SDA, I2C_SCL); Wire.begin(); Serial.begin(115200); sensor.begin(); sensor.Enable_X(); sensor.Enable_G();
/ Feed the program to Machine Learning Core / / Activity Recognition Default program / ProgramPointer = (ucf_line_t *)lsm6dsox_activity_recognition_for_mobile; TotalNumberOfLine = sizeof(lsm6dsox_activity_recognition_for_mobile) / sizeof(ucf_line_t); Serial.println("Activity Recognition for LSM6DSOX MLC"); Serial.print("UCF Number Line="); Serial.println(TotalNumberOfLine);
for (LineCounter=0; LineCounter<TotalNumberOfLine; LineCounter++) { if(sensor.Write_Reg(ProgramPointer[LineCounter].address, ProgramPointer[LineCounter].data)) { Serial.print("Error loading the Program to LSM6DSV16XSensor at line: "); Serial.println(LineCounter); while(1) { // Led blinking. digitalWrite(LED_BUILTIN, HIGH); delay(250); digitalWrite(LED_BUILTIN, LOW); delay(250); } } }
Serial.println("Program loaded inside the LSM6DSOX MLC");
//Interrupts. pinMode(INT_1, INPUT); attachInterrupt(INT_1, INT1Event_cb, RISING);
/ We need to wait for a time window before having the first MLC status / delay(3000);
sensor.Get_MLC_Output(mlc_out); printMLCStatus(mlc_out[0]); }
void loop() { if (mems_event) { mems_event=0; lsm6dsv16x_mlc_status_mainpage_t status; sensor.Get_MLC_Status(&status); if (status.is_mlc1) { lsm6dsv16x_mlc_out_t mlc_out[8]; sensor.Get_MLC_Output(mlc_out); printMLCStatus(mlc_out[0]); } } }
void INT1Event_cb() { mems_event = 1; }
void printMLCStatus(uint8_t status) { switch(status) { case 0: Serial.println("Activity: Stationary"); break; case 1: Serial.println("Activity: Walking"); break; case 4: Serial.println("Activity: Jogging"); break; case 8: Serial.println("Activity: Biking"); break; case 12: Serial.println("Activity: Driving"); break; default: Serial.println("Activity: Unknown"); break; } }
From: Carlo Parata @.> Sent: June 9, 2023 03:53 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , with respect to the example of MLC for LSM6DSOX, for LSM6DSV16X you must use the structures defined in the APIs. If you can share also the sketch that you are using, I can help you with the modifications that should be done. Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1584134153, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWSNELDT35VIJOSM3RTXKLJBPANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
…by the way, there is no example of MLC for LSM6DSV16x on github. I imitated the code from the example of MLC for LSM6dsox
From: Fehmi Karaalioglu @.> Sent: June 9, 2023 07:39 To: stm32duino/LSM6DSV16X @.>; stm32duino/LSM6DSV16X @.> Cc: Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
/**
*/ //NOTE: This example isn't compatible with Arduino Uno. //NOTE: For this example you need the STEVAL-MKI197V1 board connected to the DIL24 connector of the X-NUCLEO-IKS01A3
// Includes
//Interrupts. volatile int mems_event = 0;
LSM6DSV16XSensor sensor (&Wire); int32_t accel[3], angrate[3];
// MLC ucf_line_t *ProgramPointer; int32_t LineCounter; int32_t TotalNumberOfLine;
void INT1Event_cb(); void printMLCStatus(uint8_t status);
void setup() { uint8_t mlc_out[8]; // Led. pinMode(LED_BUILTIN, OUTPUT);
// Force INT1 of LSM6DSOX low in order to enable I2C pinMode(INT_1, OUTPUT);
digitalWrite(INT_1, LOW);
delay(200);
// Initialize serial for output. Serial.begin(115200); Wire.setPins(I2C_SDA, I2C_SCL); Wire.begin(); Serial.begin(115200); sensor.begin(); sensor.Enable_X(); sensor.Enable_G();
/ Feed the program to Machine Learning Core / / Activity Recognition Default program / ProgramPointer = (ucf_line_t *)lsm6dsox_activity_recognition_for_mobile; TotalNumberOfLine = sizeof(lsm6dsox_activity_recognition_for_mobile) / sizeof(ucf_line_t); Serial.println("Activity Recognition for LSM6DSOX MLC"); Serial.print("UCF Number Line="); Serial.println(TotalNumberOfLine);
for (LineCounter=0; LineCounter<TotalNumberOfLine; LineCounter++) { if(sensor.Write_Reg(ProgramPointer[LineCounter].address, ProgramPointer[LineCounter].data)) { Serial.print("Error loading the Program to LSM6DSV16XSensor at line: "); Serial.println(LineCounter); while(1) { // Led blinking. digitalWrite(LED_BUILTIN, HIGH); delay(250); digitalWrite(LED_BUILTIN, LOW); delay(250); } } }
Serial.println("Program loaded inside the LSM6DSOX MLC");
//Interrupts. pinMode(INT_1, INPUT); attachInterrupt(INT_1, INT1Event_cb, RISING);
/ We need to wait for a time window before having the first MLC status / delay(3000);
sensor.Get_MLC_Output(mlc_out); printMLCStatus(mlc_out[0]); }
void loop() { if (mems_event) { mems_event=0; lsm6dsv16x_mlc_status_mainpage_t status; sensor.Get_MLC_Status(&status); if (status.is_mlc1) { lsm6dsv16x_mlc_out_t mlc_out[8]; sensor.Get_MLC_Output(mlc_out); printMLCStatus(mlc_out[0]); } } }
void INT1Event_cb() { mems_event = 1; }
void printMLCStatus(uint8_t status) { switch(status) { case 0: Serial.println("Activity: Stationary"); break; case 1: Serial.println("Activity: Walking"); break; case 4: Serial.println("Activity: Jogging"); break; case 8: Serial.println("Activity: Biking"); break; case 12: Serial.println("Activity: Driving"); break; default: Serial.println("Activity: Unknown"); break; } }
From: Carlo Parata @.> Sent: June 9, 2023 03:53 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , with respect to the example of MLC for LSM6DSOX, for LSM6DSV16X you must use the structures defined in the APIs. If you can share also the sketch that you are using, I can help you with the modifications that should be done. Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1584134153, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWSNELDT35VIJOSM3RTXKLJBPANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
Hello @Fehmi-Karaal , try this code:
// Includes
#include "LSM6DSV16XSensor.h"
#include "lsm6dsv16x_activity_recognition_for_mobile.h"
#include <Wire.h>
#include <Arduino.h>
#define I2C_SDA 21
#define I2C_SCL 22
#define INT_1 A5
//Interrupts.
volatile int mems_event = 0;
LSM6DSV16XSensor sensor (&Wire);
int32_t accel[3], angrate[3];
// MLC
ucf_line_t *ProgramPointer;
int32_t LineCounter;
int32_t TotalNumberOfLine;
void INT1Event_cb();
void printMLCStatus(uint8_t status);
void setup() {
lsm6dsv16x_mlc_out_t mlc_out;
// Led.
pinMode(LED_BUILTIN, OUTPUT);
// Force INT1 of LSM6DSOX low in order to enable I2C
pinMode(INT_1, OUTPUT);
digitalWrite(INT_1, LOW);
delay(200);
// Initialize serial for output.
Serial.begin(115200);
Wire.setPins(I2C_SDA, I2C_SCL);
Wire.begin();
Serial.begin(115200);
sensor.begin();
sensor.Enable_X();
sensor.Enable_G();
/* Feed the program to Machine Learning Core */
/* Activity Recognition Default program */
ProgramPointer = (ucf_line_t *)lsm6dsv16x_activity_recognition_for_mobile;
TotalNumberOfLine = sizeof(lsm6dsv16x_activity_recognition_for_mobile) / sizeof(ucf_line_t);
Serial.println("Activity Recognition for LSM6DSV16X MLC");
Serial.print("UCF Number Line=");
Serial.println(TotalNumberOfLine);
for (LineCounter=0; LineCounter<TotalNumberOfLine; LineCounter++) {
if(sensor.Write_Reg(ProgramPointer[LineCounter].address, ProgramPointer[LineCounter].data)) {
Serial.print("Error loading the Program to LSM6DSV16XSensor at line: ");
Serial.println(LineCounter);
while(1) {
// Led blinking.
digitalWrite(LED_BUILTIN, HIGH);
delay(250);
digitalWrite(LED_BUILTIN, LOW);
delay(250);
}
}
}
Serial.println("Program loaded inside the LSM6DSOX MLC");
//Interrupts.
pinMode(INT_1, INPUT);
attachInterrupt(INT_1, INT1Event_cb, RISING);
/* We need to wait for a time window before having the first MLC status */
delay(3000);
sensor.Get_MLC_Output(&mlc_out);
printMLCStatus(mlc_out.mlc1_src);
}
void loop() {
if (mems_event) {
mems_event=0;
lsm6dsv16x_mlc_status_mainpage_t status;
sensor.Get_MLC_Status(&status);
if (status.is_mlc1) {
lsm6dsv16x_mlc_out_t mlc_out;
sensor.Get_MLC_Output(&mlc_out);
printMLCStatus(mlc_out.mlc1_src);
}
}
}
void INT1Event_cb() {
mems_event = 1;
}
void printMLCStatus(uint8_t status) {
switch(status) {
case 0:
Serial.println("Activity: Stationary");
break;
case 1:
Serial.println("Activity: Walking");
break;
case 4:
Serial.println("Activity: Jogging");
break;
case 8:
Serial.println("Activity: Biking");
break;
case 12:
Serial.println("Activity: Driving");
break;
default:
Serial.println("Activity: Unknown");
break;
}
}
pay attention that you must use the bytecode for LSM6DSV16X that you can find here. Let me know if it works. Best Regards, Carlo
...that worked. Perfect. Thank you so much. I appreciate your time and effort. I suggest you add the repository on Git Hub so that others can benefit from that.
Best Regards, Fehmi Karaalioglu
From: Carlo Parata @.> Sent: June 9, 2023 08:04 To: stm32duino/LSM6DSV16X @.> Cc: Fehmi Karaalioglu @.>; Mention @.> Subject: Re: [stm32duino/LSM6DSV16X] no matching function for call to 'TwoWire::TwoWire(int, int)' (Issue #7)
Hello @Fehmi-Karaalhttps://github.com/Fehmi-Karaal , try this code:
// Includes
//Interrupts. volatile int mems_event = 0;
LSM6DSV16XSensor sensor (&Wire); int32_t accel[3], angrate[3];
// MLC ucf_line_t *ProgramPointer; int32_t LineCounter; int32_t TotalNumberOfLine;
void INT1Event_cb(); void printMLCStatus(uint8_t status);
void setup() { lsm6dsv16x_mlc_out_t mlc_out; // Led. pinMode(LED_BUILTIN, OUTPUT);
// Force INT1 of LSM6DSOX low in order to enable I2C pinMode(INT_1, OUTPUT);
digitalWrite(INT_1, LOW);
delay(200);
// Initialize serial for output. Serial.begin(115200); Wire.setPins(I2C_SDA, I2C_SCL); Wire.begin(); Serial.begin(115200); sensor.begin(); sensor.Enable_X(); sensor.Enable_G();
/ Feed the program to Machine Learning Core / / Activity Recognition Default program / ProgramPointer = (ucf_line_t *)lsm6dsv16x_activity_recognition_for_mobile; TotalNumberOfLine = sizeof(lsm6dsv16x_activity_recognition_for_mobile) / sizeof(ucf_line_t); Serial.println("Activity Recognition for LSM6DSV16X MLC"); Serial.print("UCF Number Line="); Serial.println(TotalNumberOfLine);
for (LineCounter=0; LineCounter<TotalNumberOfLine; LineCounter++) { if(sensor.Write_Reg(ProgramPointer[LineCounter].address, ProgramPointer[LineCounter].data)) { Serial.print("Error loading the Program to LSM6DSV16XSensor at line: "); Serial.println(LineCounter); while(1) { // Led blinking. digitalWrite(LED_BUILTIN, HIGH); delay(250); digitalWrite(LED_BUILTIN, LOW); delay(250); } } }
Serial.println("Program loaded inside the LSM6DSOX MLC");
//Interrupts. pinMode(INT_1, INPUT); attachInterrupt(INT_1, INT1Event_cb, RISING);
/ We need to wait for a time window before having the first MLC status / delay(3000);
sensor.Get_MLC_Output(&mlc_out); printMLCStatus(mlc_out.mlc1_src); }
void loop() { if (mems_event) { mems_event=0; lsm6dsv16x_mlc_status_mainpage_t status; sensor.Get_MLC_Status(&status); if (status.is_mlc1) { lsm6dsv16x_mlc_out_t mlc_out; sensor.Get_MLC_Output(&mlc_out); printMLCStatus(mlc_out.mlc1_src); } } }
void INT1Event_cb() { mems_event = 1; }
void printMLCStatus(uint8_t status) { switch(status) { case 0: Serial.println("Activity: Stationary"); break; case 1: Serial.println("Activity: Walking"); break; case 4: Serial.println("Activity: Jogging"); break; case 8: Serial.println("Activity: Biking"); break; case 12: Serial.println("Activity: Driving"); break; default: Serial.println("Activity: Unknown"); break; } }
pay attention that you must use the bytecode for LSM6DSV16X that you can find herehttps://raw.githubusercontent.com/STMicroelectronics/STMems_Machine_Learning_Core/master/application_examples/lsm6dsv16x/activity_recognition_for_mobile/lsm6dsv16x_activity_recognition_for_mobile.h. Let me know if it works. Best Regards, Carlo
— Reply to this email directly, view it on GitHubhttps://github.com/stm32duino/LSM6DSV16X/issues/7#issuecomment-1584468226, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AULRPWVAY7QNFHN6OHPQ56TXKMGLBANCNFSM6AAAAAAVLITEKQ. You are receiving this because you were mentioned.Message ID: @.***>
Hello, When I apply the sensor API in ReadMe session. I take this error.