Error ADC

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Error ADC

跳至解决方案
2,807 次查看
Awera
Contributor III

Hi,

 

I am working with 52259 chip and its M52259EVB board.

I am trying to expand flexcan example with adc extra functions.

I test my evb board with adc example. And I have check flexcan example. All it is ok.

But when I try use to code of first code into second code example I have problems.

I can not open ADC device "f = fopen(MY_ADC, (const char*)&adc_init);" in flexcan code.

But I can open the channel:  "f_ch1 = fopen(MY_ADC "first", (const char*)&adc_channel_param1);" in flexcan code.

In fact, i can send data trough can but always f is empty, its value is NULL. I don't understant it. I can't open the device but instead i can open the channel.

The same code works in the adc example code.

 

I need help

Thank you

0 项奖励
回复
1 解答
1,952 次查看
JuroV
NXP Employee
NXP Employee
if(f == NULL);  // <--- mistake, redundant semicolon
{    printf("\n Opening ADC driver failed.Error Code.\n",f);    _task_block();   }

在原帖中查看解决方案

0 项奖励
回复
6 回复数
1,952 次查看
JuroV
NXP Employee
NXP Employee

Can you paste code here?

0 项奖励
回复
1,952 次查看
Awera
Contributor III

Hi,

 

My code is this:

 

 

void Adc_task(uint_32 initial_data){const ADC_INIT_STRUCT adc_init = {    ADC_RESOLUTION_DEFAULT,     };const ADC_INIT_CHANNEL_STRUCT adc_channel_param1 = {    BSP_ADC_CH_POT,     ADC_CHANNEL_MEASURE_LOOP | ADC_CHANNEL_START_TRIGGERED,      1,                 0,                 30000,            0x10000,            10,                 MY_TRIGGER,     #if MQX_USE_LWEVENTS    &event_adc,    0x01            #endif};FILE_PTR  f;FILE_PTR  f_ch1;ADC_RESULT_STRUCT data;f = fopen(MY_ADC, (const char*)&adc_init);if(f == NULL);{    printf("\n Opening ADC driver failed.Error Code.\n",f);    _task_block();   }f_ch1 = fopen(MY_ADC "first", (const char*)&adc_channel_param1);if(f_ch1 == NULL)    {            printf("Opening channel 1 failed\n");        _task_block();    }ioctl(f, IOCTL_ADC_FIRE_TRIGGER, (pointer) MY_TRIGGER);while(TRUE){}

 I can send data trough bus can but always f is empty, its value is NULL. I can't open adc device but i can open the first channel of ADC

 

Thanks you

 

0 项奖励
回复
1,952 次查看
JuroV
NXP Employee
NXP Employee

Did not your task stack overflow?

0 项奖励
回复
1,952 次查看
Awera
Contributor III

No, it isn't. It's not a problem of the stack.

 

I think it's really strange. When I execute fopen I always get NULL but after, I can use perfectly the ADC.

 

 Have you got any idea about this?

 

Thanks for your reply.

 

0 项奖励
回复
1,953 次查看
JuroV
NXP Employee
NXP Employee
if(f == NULL);  // <--- mistake, redundant semicolon
{    printf("\n Opening ADC driver failed.Error Code.\n",f);    _task_block();   }
0 项奖励
回复
1,952 次查看
Awera
Contributor III

I'm a dummy...I have wasted too much time thinking wrong.

 

Thank you very much JuroV

 

 

0 项奖励
回复