Ganging Sensors with SmartSense UserModule of Capsense | Cypress Semiconductor
Ganging Sensors with SmartSense UserModule of Capsense
How to implement ganging of Sensors with SmartSense Capsense Usermodules ?
Let us consider we need to gang 3 sensors and scan it as well we need to scan them as individual sensors. The idea is to have a fourth dummy sensor and during scanning/calibration of the fourth sensor, instead of connecting the AMUX bus to the fourth sensor, connect the three sensors which you would wish to gang. This is achieved by the use of Custom Userdefined functions instead of SmartSense_EnableSensor , SmartSense_DisableSensor and SmartSense_ClearSensors APIs.
I am attaching the project with sensor ganging in Smartsense. The GPIOs P2, P2 and P3 are used for individual sensors. For the ganged scanning of the above 3 sensors, I have used a dummy sensor in the CSD wizard at P1. The basic idea is again demonstrated below.
1) During calibration of the sensor, the scan_sensor is called which does the AMUX connections individually.
2) Replace the SmartSense_ClearSensors API with "Clear_All" function where all the sensor connections to the AMUX are broken before start of calibration of sensors.
3) Now the idea is that do not use the Smartsense_EnableSensor available. Comment it and replace with a custom function "Connect_Sensor" where the AMUX connections for the respective sensors are made before its scanning.
3) Similarly replace SmartSense_DisableSensor with "DisConnect_Sensor" where the AMUX disconnections are done for the respective sensors are made after its scanning.
Thus the calibration of individual sensor(P2, P2 and P3) is similar to the existing UserModule Implementation. On the other hand, when scanning the sensor during calibration, instead of connecting the AMUX to P1, connect all the GPIOs P2, P2 and P3 to the AMUX bus and calibrate the IDAC and set other parameters. The same idea applies for scanning also.
NOTE: You can add as many sensors in SmartSense wizard and build the project. Then make the required changes in the SmartSense.asm file by comparing with the attached file (Modified_SmartSense.txt). Add the changes in Connect_Sensor, DisConnect_Sensor and Clear_All user defined functions in main.c accordingly.