How to visualize USAFA electrode variables

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to visualize USAFA electrode variables

432 Views
afcec
Contributor I

Hi, I have been working with Freemaster in the past, mainly to tune the parameters of USAFA electrodes used as buttons or sliders. The point is that all the related Freemaster files had been generated by other colleagues and now I have started a new project from scratch, I am experiencing some issues when trying to find the main variables I was used to deal with: measured, predicted, baseline, deadband, noise...

When I select the symbol file and then I try to generate the variables, I can see, for example, all the keydetector parameters but I have not been able to find the electrode signals I need to visualize... 

How can I reach them? Thanks

 

0 Kudos
Reply
2 Replies

165 Views
arun07
Contributor III

Hi @afcec as discussed by @MichalH 

As far as I know, the Touch UI script running in FreeMASTER project tries to locate all electrodes and touch controls dynamically by reading chains and trees of RAM structures pointing to each other.  

If your touch controls and electrode structures are defined the same way in the C code as in the original project, they should appear in the FreeMASTER Touch UI automatically. If not, the FreeMASTER has probably problems to access RAM or get symbolic data from the ELF file.

This is discussed previously in the community, and is as below.

https://community.nxp.com/t5/FreeMASTER/Touch-Tuning-variables-not-plotted-on-Oscilloscope-for-a-Cus...

Two methods are specified in the above link, you can use one of this method.

The simple method of using global variable is as below.

When u receive the "NT_SYSTEM_EVENT_MODULE_DATA_READY" event from the NXP touch library, you can use this event to save data in these global variables, as shown below.

static void system_callback(uint32_t event, union nt_system_event_context *context)
{
  uint32_t touch_scan_cmplt_time = 0;
  switch (event)
  {
    case NT_SYSTEM_EVENT_OVERRUN:
      DBG_PRINTF_RED( "system_callback: NT_SYSTEM_EVENT_OVERRUN\n");
      break;
    case NT_SYSTEM_EVENT_DATA_READY:
      DBG_PRINTF_GREEN( "system_callback: NT_SYSTEM_EVENT_DATA_READY\n");
      break;
    case NT_SYSTEM_EVENT_MODULE_DATA_READY:
      // DBG_PRINTF_GREEN( "system_callback: NT_SYSTEM_EVENT_MODULE_DATA_READY\n");
      touch_scan_cmplt_time = millis();
      touch_meas_time = touch_scan_cmplt_time - touch_start_time;
      touch_log_electrode();
      break;
    case NT_SYSTEM_EVENT_DATA_OVERFLOW:
      DBG_PRINTF_GREEN( "system_callback: NT_SYSTEM_EVENT_DATA_OVERFLOW\n");
      break;
    // and so on.......
    // your code....
}

static void touch_log_electrode( void )
{  
  struct nt_control *control = NULL;
  struct nt_electrode_data *electrode = NULL;
  struct nt_keydetector_usafa_data *usafa  = NULL;
  
  control = (struct nt_control*)&keypad_1;
  
  for( uint8_t idx=0; idx<TOUCH_ELECTRODES_NUM; idx++ )
  {
    electrode = NULL;
    electrode = nt_electrode_get_data( control->electrodes[idx] );
    
    if( NULL != electrode )
    {
      usafa                     = electrode->keydetector_data.usafa;
      dbg_baseline[idx]        = electrode->baseline;
      dbg_signal[idx]          = electrode->signal;
      dbg_deadband_h[idx]      = usafa->deadband_h;
      dbg_predicted[idx]       = usafa->predicted_signal;
      dbg_noise[idx]           = usafa->noise;
      dbg_entry_event_cnt[idx] = usafa->entry_event_cnt;
      dbg_deadband_cnt[idx]    = usafa->deadband_cnt;
    }
  }
}

 

and then u can use these "dbg_*" variables to plot the baseline, predicted, signal etc.. on FreeMASTER oscilloscope.

I hope this helps.

0 Kudos
Reply

422 Views
MichalH
NXP Apps Support
NXP Apps Support

Hello, 

This forum is focused more on FreeMASTER tool itself, not particular UI projects loaded into the FreeMASTER. This is why my answer will be quite generic. But I will also try to seek help in the Touch team who supports this UI.

As far as I know, the Touch UI script running in FreeMASTER project tries to locate all electrodes and touch controls dynamically by reading chains and trees of RAM structures pointing to each other.  

If your touch controls and electrode structures are defined the same way in the C code as in the original project, they should appear in the FreeMASTER Touch UI automatically. If not, the FreeMASTER has probably problems to access RAM or get symbolic data from the ELF file.

For further analysis, can you send a screenshot of your original UI (which works well) and a screenshot of the UI with missing signals?

Thanks,
Michal

 

 

0 Kudos
Reply