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
已解决! 转到解答。
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
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.