Hi, I'm reading through /dev/ttyMCC to get analog input from Arduino back to the CPU using Linux and minicom. When I read something using a timer on Arduino side, I get a kernel message above the minicom output. Here is my Arduino sketch: Code: #include <math.h> #include <imx6sx_sdb_m4.h> #include <hwtimer_epit.h> #define NB_MESURES 600 #define PIN A0 HWTIMER timer; float TabV0[NB_MESURES]; int n = 0; void readValue(void *param) { TabV0[n] = analogRead(PIN); Serial.print("test: "); Serial.println(TabV0[n]); n = (n + 1) % NB_MESURES; } void setup() { analogReadResolution(12); Serial.begin(115200); hwtimer_init(&timer, &BSP_HWTIMER1_DEV, BSP_HWTIMER1_ID, 1); hwtimer_set_period(&timer, BSP_HWTIMER1_SOURCE_CLK, 1000000); hwtimer_callback_reg(&timer, readValue, 0); hwtimer_start(&timer); } void loop() { } Here is the output of: Code: minicom -D /dev/ttyMCC Code: Welcome to minicom 2.7 OPTIONS: I18n Compiled on Oct 20 2016, 12:12:22. Port /dev/ttyMCC Press CTRL-A Z for help on special keys [ 1737.880825] mcc int still be triggered after 101 ms polling! [ 1739.900845] mcc int still be triggered after 101 ms polling! test: [ 1741.920839] mcc int still be triggered after 101 ms polling! 2753[ 1743.940851] mcc int still be triggered after 101 ms polling! .[ 1745.960855] mcc int still be triggered after 101 ms polling! 0[ 1747.980916] mcc int still be triggered after 101 ms polling! 0[ 1750.000909] mcc int still be triggered after 101 ms polling! [ 1752.020850] mcc int still be triggered after 101 ms polling! test: [ 1754.040852] mcc int still be triggered after 101 ms polling! 2752[ 1756.060853] mcc int still be triggered after 101 ms polling! .[ 1758.080846] mcc int still be triggered after 101 ms polling! 0[ 1760.100844] mcc int still be triggered after 101 ms polling! 0[ 1762.120822] mcc int still be triggered after 101 ms polling! [ 1764.140898] mcc int still be triggered after 101 ms polling! test: [ 1766.160867] mcc int still be triggered after 101 ms polling! 2754[ 1768.180926] mcc int still be triggered after 101 ms polling! .[ 1770.200849] mcc int still be triggered after 101 ms polling! 0
I never have seen this before. What if you compile and send this sketch from the Arduino IDE on the Neo itself and have the serial monitor of the IDE already opened? In this way we rule out buffer issues that ttyMCC can have.
I don't have an UI on my UDOO Neo (I don't need it for embedded device). I'll try with an installation of UDOObuntu to test.
I don't reboot after uploaded the sketch to M4. I don't have a micro HDMI cable now to test with UDOObuntu but I'll do it later.
Hi. BSP_HWTIMER1 is used to implement micros. Using it compromises micros(). As an alternative, you can use the yield() function in the sketch: Code: void yield (void) { delay(1000); ReadValue(); }
Hi. This method is not accurate at all. The point is to get the value at a certain frequency, not after a certain time.