Community
cancel
Showing results for 
Search instead for 
Did you mean: 
杰廖杰
New Contributor I
936 Views

Edison MCU's questions: debug, latence, reset

Jump to solution

Hi,

Edison has IPC build in to communication between Host CPU and MCU.

By referening https://software.intel.com/en-us/articles/using-an-mcu-on-the-intel-edison-board-with-the-ultrasonic... Using an MCU on the Intel® Edison Board with the Ultrasonic Range Sensor | Intel® Software , I have a few question about debugging and latence of IPC.

Host CPU write command to MCU:

f.write('get_distance\n') # Send command to MCU

f.flush()

and then read back the result:

line = f.readline() # Read response from MCU, -1 = ERROR

---Will the CPU wait for MCU's feedback result always? (wait MCU do ' host_send(buf, len);' )

---What will happen if MCU don't feedback the result?

Is there any simple tool to simulate the 'Host' or 'MCU' ? or the console command? (Yes I know the 'cat' command can monitor the MCU's debug_printf contents).

Or I must write python program on Host and C on the MCU?

How to debug them side by side?

Another question is about 'reset' -- after download code into MCU, the kernel will 'reset' -- cost a lot of time.

Thanks

James

0 Kudos
1 Solution
idata
Community Manager
72 Views

Hi JamesLeo,

 

 

Thank you so much for contacting us, I will try to answer all your questions in order:

 

 

About the CPU's waiting time, as you can see in the code (line = f.readline() # Read response from MCU, -1 = ERROR), the function readline() reads the response from MCU, it will receive characters from the serial port until a newline (Python '\n') character is received; when it gets one it returns the line of text it has got so far, so yes the CPU will wait for MCU's response.

 

 

In the script on the way that it was made, the program won't continue until he receives the response from the MCU, because it will be waiting forever if no newline character is received.

 

 

As far as I know, I think that there isn't another tool to debug the Host or the MCU, so yes you have to use the terminal. The MCU's code is normally written in C/C++ (MCU SDK), but your Host program can be written in any supported language like C ( https://software.intel.com/en-us/node/557354# Communicating_between_the_host_and_the_MCU).

 

 

Regarding your last question, yes it always reboots the device to download the binaries into the MCU.

 

 

I hope you find this information helpful.

 

 

Regards,

 

-Leonardo

View solution in original post

5 Replies
idata
Community Manager
73 Views

Hi JamesLeo,

 

 

Thank you so much for contacting us, I will try to answer all your questions in order:

 

 

About the CPU's waiting time, as you can see in the code (line = f.readline() # Read response from MCU, -1 = ERROR), the function readline() reads the response from MCU, it will receive characters from the serial port until a newline (Python '\n') character is received; when it gets one it returns the line of text it has got so far, so yes the CPU will wait for MCU's response.

 

 

In the script on the way that it was made, the program won't continue until he receives the response from the MCU, because it will be waiting forever if no newline character is received.

 

 

As far as I know, I think that there isn't another tool to debug the Host or the MCU, so yes you have to use the terminal. The MCU's code is normally written in C/C++ (MCU SDK), but your Host program can be written in any supported language like C ( https://software.intel.com/en-us/node/557354# Communicating_between_the_host_and_the_MCU).

 

 

Regarding your last question, yes it always reboots the device to download the binaries into the MCU.

 

 

I hope you find this information helpful.

 

 

Regards,

 

-Leonardo

View solution in original post

杰廖杰
New Contributor I
72 Views

Hi, Leonardo,

Is there any command in terminal mode to read/write dev/ttyxx? and the internal IPC pipe? Or I must program in python(or Nodejs...) like the ultrasonic's sample?

Should I 'printf' at the MCU side first? -- if 'cat' dev/ttyMCUx later?

Does the 'cat' command wait for 'printf' command executed at MCU side forever?

Thanks

James

idata
Community Manager
72 Views

Hi JamesLeo,

 

 

Did you check the link that I gave you? ( https://software.intel.com/en-us/node/557354# Communicating_between_the_host_and_the_MCU).

 

 

As you can see in the step 6, you can write in the serial port using the "echo" command, and use the command "cat" to read it.

 

 

When you use the "cat" command, it is like to open the port and you close it using CTRL+C. If you keep it open you will see when the MCU send something using the function host_send(), so you can use the cat command at the beginning and keep it open to see all the results, or at least that you have to send something to the MCU from the host.

 

 

I hope you find this information helpful.

 

 

Regards,

 

-Leonardo
杰廖杰
New Contributor I
72 Views

Hi, Leonardo,

Thanks for your help.

I'll try the 'echo'/host_send() command.

Best Regards

James

idata
Community Manager
72 Views

Hi JamesLeo,

 

 

That's great.

 

 

Don't doubt to ask us if you have issues with it.

 

 

Regards,

 

-Leonardo

 

Reply