2021-12-16 05:06 AM
Hi,
As we were trying to interface CPT112s capacitive touch controller with STM32 using I2C,
we were able to get the I2C working...but I was not able to get touch event (either 1 or any high value)
Below is my address reference for both device and memory.
uint16_t DevAddress1 = 0xC0<<1;
uint16_t MemAddress1 = 0xC0200000;
uint8_t mac_id_buf[6] = "";
char print_msg[100] = "";
if(HAL_OK == HAL_I2C_IsDeviceReady(&hi2c1,DevAddress1,200,2000)){
if(HAL_OK == HAL_I2C_Mem_Read(&hi2c1,DevAddress1,MemAddress1,I2C_MEMADD_SIZE_8BIT,(uint8_t*)&mac_id_buf[0],0x0006,HAL_MAX_DELAY)) {
strcpy(print_msg,"SUCCESS HAL_I2C_Mem_Read\r\n");
HAL_UART_Transmit(&huart5,(uint8_t*)print_msg,strlen(print_msg),1000);
sprintf(print_msg,"%X %X %X %X %X %X\r\n", mac_id_buf[0],mac_id_buf[1],mac_id_buf[2],mac_id_buf[3],mac_id_buf[4],mac_id_buf[5]);
HAL_UART_Transmit(&huart5,(uint8_t*)print_msg,strlen(print_msg),1000);
}
else{
strcpy(print_msg,"ERROR in HAL_I2C_Mem_Read()\r\n");
}
}
else{
strcpy(print_msg,"ERROR in HAL_I2C_IsDeviceReady()\r\n");
}
Kindly let me know what changes needed to be done so that I can get the capactive sense value .
Thanks and regards
Ravi chandra
2021-12-24 07:43 AM
2021-12-27 11:27 PM
Hi,
I do not want any assistance in writing the code as we are doing it from our side...it more that we wanted to see if you had come across CPT112S chip so that we can get the address issue resolved.we got the I2C working and rest of our module ourselves...nothing to worry.
Thanks and regards
Ravi
2021-12-28 04:16 AM
2021-12-29 12:18 AM
Hi,
Any udpate on the INT pin way we have wriiten..we are using PB1 which we have configured in CUBEMX ,then generated the code..the name we have given is KEYPAD INT..which we are trying to read when it is low and then read the I2C data...hope this is fine..kindly let us know. I have attached the code in my previous post.
Thanks
Ravi
2021-12-29 12:19 AM
Just guide me in the way we are reading the INT while we have configured,,will help us a lot
Thanks and regards
Ravi
2021-12-30 05:08 AM