AnsweredAssumed Answered

Vybrid VF6xx : LWADC crash

Question asked by Jeremy Esquirol on Feb 10, 2015
Latest reply on Feb 13, 2015 by Jeremy Esquirol

Hello,

 

I try to use example of lwadc on MQX 4.0.2 (Timesys) on TWR_VF6XX. I follow the Timesys "How To " for building MQX BSP and PSP.  I'm able to launch mcc-pingpong demo and it works on my board.

However, I need to do some measure using ADC. I found the example "lwadc_twrvf65gs10_m4", It build without error but when I launch it it seems it crashes in  monitor_potentiometer function when calling "_lwadc_get_attribute(...,LWADC_REFERENCE, &reference))" .

I  comment this function, it doesn't crash but the adc's value doesn't change when I moove the potentiometer:

Here is a sample of my code :

input = BSP_ADC_POTENTIOMETER;

_lwadc_init_input(&potentiometer,input);

  

/* We want to change the default scaling of the potentiometer to return a percent instead of milli-volts.

 

printf("Rotate potentiometer. Test will run until readings range from  10%% to 90%% \n");

 

while(1) {

//read ADC value

_lwadc_read_raw(&potentiometer, &percent);
printf("potentiometer = %d\n",percent);
_lwadc_wait_next(&potentiometer);
}

With this code, i get on my serial :

     potentiometer = 756

     potentiometer = 756

     potentiometer = 756

 

Do I forgot something?

 

note : the potentiometer is working fine. I test it with multimeter.

Outcomes