Compensation Capacitor value not updating

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Currently using the datastreamer to see signal and capacitance values of a self-cap sensor, however the only value not updating is the compensation cap value. When I try to manually call the update function after getting sensor cc value, the values start to freak out for every function called. Any insight would be great thanks!

 

In datastreamer_UART_sam.c: 

 

datastreamer_transmit(sequence);
    for (count_bytes_out = 0u; count_bytes_out < DEF_NUM_CHANNELS; count_bytes_out++) {

        /* Signals */
        u16temp_output = get_sensor_node_signal(count_bytes_out);
        datastreamer_transmit((uint8_t)u16temp_output);
        datastreamer_transmit((uint8_t)(u16temp_output >> 8u));
        
        
        /* Reference */
        u16temp_output = get_sensor_node_reference(count_bytes_out);
        datastreamer_transmit((uint8_t)u16temp_output);
        datastreamer_transmit((uint8_t)(u16temp_output >> 8u));
        
        /* Touch delta */
        temp_int_calc = get_sensor_node_signal(count_bytes_out);
        temp_int_calc -= get_sensor_node_reference(count_bytes_out);
        u16temp_output = (uint16_t)(temp_int_calc);
        datastreamer_transmit((uint8_t)u16temp_output);
        datastreamer_transmit((uint8_t)(u16temp_output >> 8u));
        
        /* Comp Caps */
        u16temp_output = get_sensor_cc_val(count_bytes_out);
        datastreamer_transmit((uint8_t)u16temp_output);
        datastreamer_transmit((uint8_t)(u16temp_output >> 10u));

 

In touch.c I have: 

 

uint16_t get_sensor_cc_val(uint16_t sensor_node)
{
    return (ptc_qtlib_node_stat1[sensor_node].node_comp_caps);
}
void update_sensor_cc_val(uint16_t sensor_node, uint16_t new_cc_value)
{
    ptc_qtlib_node_stat1[sensor_node].node_comp_caps = new_cc_value;
}