Hello,
In my project, i am working with IQS7211A with esp32 but with wire.h library its not working but its working fine with the Arduino. i code execution is happening but not working as expected.
this is the log of the device.
#include <Arduino.h>
#include <Wire.h>
#include "IQS7211A.h"
// put function declarations here:
extern IQS7211A_MEMORY_MAP IQSMemoryMap;
void setup() {
uint16_t prod_num;
Serial.begin(115200);
while (!Serial);
Serial.println("Start Serial communication");
Serial.println("IQS7211A Setup start");
while (!begin());
Serial.println("Device Ready");
disableCommsReqEn(RESTART);
Serial.println("before update");
updateInfoFlags(RESTART);
Serial.println("after update");
if(checkReset())
{
Serial.println("Software Reset event occured.");
//If the Show Reset bit is set, acknowledge the reset event
acknowledgeReset(RESTART);
Serial.println("Acknowledge reset.");
}
else
{
Serial.println("i am here");
//Perform SW Reset
SW_Reset(RESTART);
Serial.println("Software Reset Bit set.");
// Read the Info flags
updateInfoFlags(RESTART);
//Check if Show Reset bit is set
if (checkReset())
{
Serial.println("Software Reset event occured.");
//If the Show Reset bit is set, acknowledge the reset event
acknowledgeReset(RESTART);
Serial.println("Acknowledge reset.");
}
}
prod_num =getProductNum(RESTART);
Serial.print("Product Number: "); Serial.print(prod_num);
if (prod_num == IQS7211A_PRODUCT_NUM)
{
Serial.println(" (Confirmed IQS7211A)");
}
else
{
Serial.println(" Device is not a IQS7211A!");
while (1);
}
Serial.print("Major Version Number: "); Serial.println(getSoftwareMajorNum(RESTART));
Serial.print("Minor Version Number: "); Serial.println(getSoftwareMinorNum(RESTART));
writeMM(RESTART);
// Clear the Comms Request Enable bit
disableCommsReqEn(RESTART);
// ATI after writing settings from h-file.
TP_ReATI(STOP);
Serial.println("IQS7211A Initialization complete.");
while (!waitForReady());
//Enable Gesture Events and TP Events
enableGestureEvent(RESTART);
enableTPEvent(RESTART);
// Enable Event Mode
setEventMode(STOP);
// Print the headers
Serial.println("Gesture: Finger 1 X: Finger 1 Y: Finger 2 X: Finger 2 Y:");
}
int val;
void loop() {
// put your main code here, to run repeatedly:
while (!waitForReady());
updateGestures(RESTART);
updateAbsCoordinates(RESTART, FINGER_1);
updateAbsCoordinates(STOP, FINGER_2);
val = IQSMemoryMap.iqs7211a_gesture_events.iqs7211a_gesture_events_lsb;
Serial.print("func_val:");
Serial.println(val);
switch (val)
{
case 0:
Serial.println("No gesture");
break;
case 1:
Serial.println("Single tap");
break;
case 2:
Serial.println("Press and Hold");
break;
case 4:
Serial.print("Swipe X Neg ");
// mySerial.println("3");
break;
case 8:
Serial.print("Swipe X Pos ");
// mySerial.println("2");
break;
case 16:
Serial.print("Swipe Y Pos ");
// mySerial.println("0");
break;
case 32:
Serial.print("Swipe Y Neg ");
// mySerial.println("1");
break;
default:
break;
}
}
please have a look and let me know how can resolve this.
Thank You.
I moved your topic to an appropriate forum category @bhanu_riosh.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
In my project, I am using an IQS550 touchpad module with esp32 but I got an i2c communication error the same code is working for Arduino and it's not working with esp32.
so this is the code part,
oid I2C_Setup(void)
{
// Set I2C clock frequency
Wire.begin(21,22);
Wire.setClock(400000);
}
void IQS5xx_AcknowledgeReset(void)
{
static uint8_t System_ctrl_0 = ACK_RESET;
I2C_Write(SystemControl0_adr, &System_ctrl_0, 1);
Serial.println("i am in acknowledgeReset");
}
uint8_t I2C_Write(uint16_t ui16RegisterAddress, uint8_t *pData, uint8_t ui8NoOfBytes)
{
uint8_t ui8Retry = 4;
ui8Success = I2C_Write2(ui16RegisterAddress, pData, ui8NoOfBytes);
Serial.println("i am in write 2");
Serial.println("err_code:");
Serial.println(ui8Success);
//
// If comms was not successful, retry 4 more times
//
while ((!ui8Success))
{
delay(100);
ui8Success = I2C_Write2(ui16RegisterAddress, pData, ui8NoOfBytes);
ui8Retry--;
}
Serial.println("i am in writeS 2");
Serial.println("err_code:");
Serial.println(ui8Success);
if (ui8Success)
{
return (TRUE);
}
else
{
Serial.println("Comms write error");
return (FALSE);
}
}
so here first, i set the wire.h library then for acknowledgment reset need to write the register but communication is not happening.
please help me to resolve this.
Thank You.
That could be a hardware problem, post your annotated schematic showing all connections, power, ground, and power sources. Also include links to technical information on each of the hardware devices. Frizzies do not contain enough information to be of any help.
Your two or more topics on the same or similar subject have been merged.
Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.
Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
Could you take a few moments to Learn How To Use The Forum
It will help you get the best out of the forum in the future.
It could be multiple problems, both hardware and software.
Can you show the rest of the code or give a link to it ?
For example the "I2C_Write2()" and the "IQS7211A.h" and every other file that you use.
The "I2C_Write2()" is associated with software I2C code.
A retry on the I2C bus is almost useless. There are sensors that disappear from the I2C bus when they are busy, and sometimes in very rare situations a retry might work if a noise glitch disturbed the I2C bus. In every other situation, when someone puts a retry in the code, that indicates a underlying problem.
Can you make a fresh start with the most common code and most common libraries that everyone uses ?
In the Arduino IDE, could you right-click on the code and select "Format Document".
Already i am doing the same thing like developing the code from scratch and I can able to detect the device using the i2c scanner code.
but after this, i couldn't implement any function.
Do you mean the "IQS5XX B000 Arduino example code" and the "IQS7211A Arduino Example Code" ? I must fill in my name and my email to see it
For the IQS5XX, they made code with a custom I2C library which is for the Arduino Uno. They should not have done that. If you want to run that on a ESP32, then someone has to read everything about the device and go through all the code to fix it. That is not an easy task.
The IQS7211A uses the Arduino Wire library in a normal way. There is still a lot to read about the chip to understand it. I don't know how to help without having that device.
There is indeed a problem with the libraries with the "Stop" or "Restart" condition and with the provided example. They are making a mess of the parameter for that. The error messages that you get are correct. To fix that, the library has to be changed.
Can you read the datasheet of the IQS7211A to check if it really needs a "Restart" on the I2C bus ? I might work with only "Stop". Then you can change the code to have a "Stop" everywhere.
Sparkfun has the IQS7211A device in a MIKROE Touchpad: https://www.sparkfun.com/products/19188
In the tab "Documents" there is a link to Github, but that is not Arduino compatible code.
Actually, we are working on this module only and not the IQS7211A module as of now. yes, I do understand the complexity of the library porting from Arduino to esp32 but I don't have another option. So I need to make it work with esp32 only.
i couldn't able to upload the zip file, its just normal email id filling, and doesn't require any registration.
Please fill the normal user details then it start downloading it