Open ddewaele opened 8 years ago
Hi there,
Can you please supply some sketches in order to reproduce the issue? Also some generic info like os, kernel version, branch, etc...
Thanks! Ek5 On 8 Dec 2015 16:11, "Davy De Waele" notifications@github.com wrote:
I'm having issues with the serial communication between the A9 and M4.
When reading data from the serial line it eithers
- hangs completely
- runs very slow
- contains corrupt data
Any ideas on how to fix this ?
— Reply to this email directly or view it on GitHub https://github.com/UDOOboard/linux_kernel/issues/14.
It's any sketch basically that sends out some data on the serial port.
The sketch that makes it crash here :
void setup()
{
Serial.begin(9600);
}
void loop()
{
int lastReading = 0;
Serial.print("{");
for(int i=0;i<6;i++) {
if(i>0) {
Serial.print(",");
}
Serial.print("\"a");
Serial.print(i);
Serial.print("\":");
lastReading = analogRead(0);
Serial.print(analogRead(i));
}
Serial.print(",\"volts\":\"");
Serial.print(lastReading * (3.3 / 4095.0));
Serial.print("v\"");
Serial.println("}");
delay(500);
}
I'm using a stock UDOO Neo and only enabled tunneling support on the kernel
Linux udooneo 3.14.28 #1 SMP PREEMPT Fri Dec 4 20:50:04 JST 2015 armv7l armv7l armv7l GNU/Linux
Here's the output from the serial line
ddewaele@udooneo:~$ sudo cat /dev/ttyMCC
{"a0":1,"a1":756
{"a0":1,"a1":880,"a2":887,"a3":951,"a4":1089,"a5":2889,"volts":"0.00v"}
{"a0":1,"a1":796874,"a3":1203,"a5":3000,"volts":"0.00v"}
{"a0":1,"a1":899870,"a3":1071,"a5":0.00v"}
{"a0":1,"a1":894,"a3":1009,"a43000,"volts":"0.00v"}
<----- it basically halts here. Also notice how the data is corrupted (empty lines, missing elements in the json , ....)
After a couple of lines the serial line goes dead, and you need a board reboot to get it up and running again.
Also, when I use nodejs libraries like https://github.com/voodootikigod/node-serialport i also get corrupted data (using a different sketch that only outputs 1 analogReading)
data received: 1963
data received: 1962
data received: 1961
data received:
data received: 1883
data received:
data received: 1623
data received:
data received: 1383
�������������΅~�~�t������������~������w������s[����������k������������5����������t_�|y�Wߚ�����������������������M��������������7����ݯ����������_��������o����~������ߟ������������������}Y߿����{߿w��~����}O������s��w��}����������|������.��=���}����}�z�W_}���_��~~g��oO�v����#��}����O��������V|�����������s������~��_���?����������[�������������߿���9}�=_���{���wu��?�1�߿z>�y��?��~���~{��ܿ���{����M�y���g�_�o��?��_����?��������߷}��������?�����wן��f�?���ҷ��������y{���g���c�����������������.�����[����}?��������o���������������}�������}/��������������������}�u��;��u��~|�%��K������[�����^�}������[}��m������Y��������_���������[}�T}������w������Gk��˙s�������d;������{�����������o��o�p�{���}����kw�s���>���������s������������>q��w~������^�=��������۫���}]���s�o�����s������W����y�?�����̟�w���������������~�����������澼����?>���}�����
I have the impression it's caused by the analogRead calls.
Also not really sure if this below is related (or should even be logged as an issue here) , but if I take the traditional blink sketch and I add some Serial output
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
Serial.println("LED ON");
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
Serial.println("LED OFF");
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
It actually blinks the LED with 4 second intervals (as opposed to 1 second intervals)
As soon as I start reading from the Serial (using sudo cat /dev/ttyMCC
) it blinks with 1 second intervals. If I exit the cat it again blinks with 4 second intervals. If I remove the Serial code it behaves normally.
One issue is with the imx6sx-udoo-neo-m4.dtsi and imx6sx-udoo-neo.dtsi:
imx6sx-udoo-neo: memory { linux,usable-memory = <0x80000000 0x3f800000>; <----- this should be 0x3f700000 reg = <0x80000000 0x40000000>; }; 0x80000000 - 0x800000 (M4) - 0x100000 (MCC)
imx6sx-udoo-neo-m4.dtsi already has this memory for the M4 so the above can be the full range...
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
/* Reserved 8Mb for M4 */
m4_memory: m4@0x84000000 {
no-map;
reg = <0x84000000 0x00800000>;
};
/* Reserved 1Mb for MCC */
mcc_memory: m4@0xBFF00000 {
no-map;
reg = <0xBFF00000 0x00100000>;
};
};
Also, for the basicks or basic neo with only 512MB of memory; MCC memory needs to be mapped to 0x9FF00000 . I'm still in the process of testing the basicks. I don't have neo with 1GB of memory.
Just need to choose which way is better reserved-memory or memory to define where reserved memory is used, but not both
Commit abdce68f40037226fc0ae3300ca75252ccb5ac02 should fix most of the issues. Please try it out and feedback.
Thanks, ek5
The link seems to be broken. The fixed one: abdce68f40037226fc0ae3300ca75252ccb5ac02
Thanks, fixed :+1:
What happens if num_of_received_bytes is == (MCC_ATTR_BUFFER_SIZE_IN_BYTES - 24)? there is a int16_t after the data member in the data structure, that would be used to old the NULL byte.
void setup() { Serial.begin(9600); pinMode(13, OUTPUT); }
// the loop function runs over and over again forever void loop() { Serial.println("LED ON"); digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second Serial.println("LED OFF"); digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
It actually blinks the LED with 4 second intervals (as opposed to 1 second intervals) As soon as I start reading from the Serial (using sudo cat /dev/ttyMCC ) it blinks with 1 second intervals. If I exit the cat it again blinks with 4 second intervals. If I remove the Serial code it behaves normally.
This issue that the not reading the /dev/ttyMCC delays the execution of the program with seconds is still there. So not solved.
I also still see missing EOL in the Arduino IDE Serial Monitor
If M4 binary works with MCC (Serial), on A9 side must be opened the endpoint for receive (cat/dev/ttyMCC), otherwise it will time out every Serial.println().
Still crashes for me with abdce68f40037226fc0ae3300ca75252ccb5ac02. Strangely, I'm not getting a crash dump even though I set CONFIG_CRASH_DUMP=y, just "Kernel panic - not syncing: Aiee, killing interrupt handler!" on the serial consiole.
In my experience (YMMV) reliability is directly correlated to the load on the A9 - and LXDE/XOrg are the main problems there. Higher level languages like Python probably take a toll too.
A lot has improved lately. No more missing lines or characters. Serial.println() still time outs if not read on A9 side though. Will these be fixed or is this as designed?
I've been having issues with the serial comm too, if I update my udoobuntu with this: https://github.com/UDOOboard/linux_kernel/commit/abdce68f40037226fc0ae3300ca75252ccb5ac02
Is it supposed to improve things? how do I update my udoobuntu with it? sorry for noob questions I'm new in a lot of this things.
@Tengoles you better ask these kind of things on the forum. To update Udoobuntu see the documentation: http://www.udoo.org/docs-neo/Software_&_Operating_Systems/UDOObuntu.html
I'm having issues with the serial communication between the A9 and M4 on my UDOO Neo
When reading data from the serial line it eithers
Any ideas on how to fix this ?