step1: modify main.cpp in arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores\arduino by adding trace_enable(0);
TODO: derive trace level and optional IP from command line
step2, use the arduino IDE to upload adc examples such as example->basic->AnalogReadSerial
the ADC value is always 0.
step 1:modify main.cpp by changing the trace leval
step 2: use the arduino IDE to upload AnalogReadSerial
the ADC value is always 0
I just want the arduino sketch to print messages in the stdout. (by using printf() in the arduino IDE). so I commented out the "freopen" for stdout/stderr in the main function. but then many trace messages were printed in the screen. so I chose to disable the trace by trace_enable(0), then the problem occured....
I can work around my problem by "comment out the printf functions in trace_main() in trace.c" (the step 4 of the original post).
it is a so strange thing that the trace part will affect the ADC part.
Yes sorry I got confused, thank you. We run again some test on your issue. These our results, let us know if they match yours.
- We added the trace_enable(0) in main.cpp. Then when we updated the sketch AnalogReadSerial. On every Analog pin we are getting 0 regardless of the voltage applied to the pin.
- We modified the original main.cpp again but this time added trace_init(TRACE_LEVEL_ERROR, 0); instead of trace_init(VARIANT_TRACE_LEVEL, 0);. With this change Analog pin 0 does not work it gets 0 for every voltage. The rest of pins (A1 – A5) work fine.
- Commented //fprintf(stderr, tmsg.tbuf); and //printf(tmsg.tbuf); as you instructed in your original post. We tried this modification with both modifications (1 and 2), but it doesn’t alter the behavior described in test 1 and 2.
Would you please confirm if this is the exact same behavior you are getting?
1 of 1 people found this helpful
I have verified @JPMontero_Intel results on my side.
However I may have a partial workaround.
Disable trace_debug by using
with this change all ADC channels work but A0.
Add line at the top of adcInit(void) inside wiring_analog.c
And now A0 is succesful in being exported and now works.
I will try to dig deeper on what exactly is causing this strange bug.
Thanks for your validation. I will respond by list.
2, yes, but i am not sure whether ADC1-5 still can work. i will try again next week (sorry that i have no edisons on hand this week)
3, yes, and it's my fault that I may mislead you in the original post. I commented out the printf without setting the trace_enable(0), in order to prevent the trace from showing in the stdout. (as in #7 post). so you can ignore the "comment-out" thing, i shouldn't write it. sorry.