Community
cancel
Showing results for 
Search instead for 
Did you mean: 
JJurr
Novice
1,711 Views

Problem getting MCU app to work

Hi all,

I'm trying to get started with programming my MCU, but I seem to be unable to get even the following very simple program to work:

# include "mcu_api.h"

# include "mcu_errno.h"

void mcu_main()

{

while (1)

{

int p = 0;

double a = 0.0;

double t = 0.0;

debug_print(DBG_DEBUG, "Pressure = %i ; Altitude = %f ; Temperature = %f \n", p, a, t);

mcu_sleep(10);

}

}

To test whether this program works, I connect to the Edison using screen:

~ ❯❯❯ screen -L /dev/cu.usbserial-DA01LN4S 115200 –L

On the Edison, I switch on debug-level logging:

echo debug > /sys/devices/platform/intel_mcu/log_level

Then I read the ttymcu1:

cat /dev/ttymcu1

However, I only get the following message:

(50158000,DEBUG): ipc process succeed

What I would expect is a long list of

Pressure = 0 ; Altitude = 0.000000 ; Temperature = 0.000000

Pressure = 0 ; Altitude = 0.000000 ; Temperature = 0.000000

Pressure = 0 ; Altitude = 0.000000 ; Temperature = 0.000000

Pressure = 0 ; Altitude = 0.000000 ; Temperature = 0.000000

...

I'm running Poky (Yocto Project Reference Distro) 1.7.3 from the 3.0 board release with the 1.0.10 MCU SDK.

What am I doing wrong?

9 Replies
idata
Community Manager
95 Views

Hi norm2782,

 

 

After uploading the MCU script, you should run the command cat /dev/ttymcu1 on Edison, without anything else.

 

 

On the other hand, have you tried using DBG_INFO instead of DBG_DEBUG?

 

 

Regards,

 

Diego
JJurr
Novice
95 Views

Hi Diego,

Just running the cat command does not produce a different result. Using DBG_INFO instead of DBG_DEBUG does not appear to have a effect either. Even when I set it to DBG_FATAL, I don't get anything on ttymcu1. Using floats instead of doubles (as used in my original example) doesn't make a difference either.

Interestingly, though, when I connect via the IDE's MCU > Connect menu, I do get a "(187884000,DEBUG): ipc process succeed".

idata
Community Manager
95 Views

Hi norm2782,

 

 

As you can see in the following guide: https://software.intel.com/en-us/node/545144 https://software.intel.com/en-us/node/545144, when you connect via MCU>Connect, the message "ipc process succeed" is expected to appear.

 

 

Anyhow, I'll try to replicate what you are doing and see if I'm able to get the message from the debug_print() statement. I'll come back with an update as soon as possible.

 

 

Regards,

 

Diego
idata
Community Manager
95 Views

Hi norm2782,

 

 

The debug_print() function only supports \%d, \%x, \%s. So float/double type is not supported. Have you checked the following examples: https://software.intel.com/en-us/node/557354 https://software.intel.com/en-us/node/557354? I recommend you to test them and see if you are able to get data from cat /dev/ttymcu1.

 

 

Regards,

 

Diego
JJurr
Novice
95 Views

Hi Diego,

Thanks for looking that up! Is there any API documentation of these limitations? And does sprintf have the same limitations?

JJurr
Novice
95 Views

Something strange is going on. I've taken the following example from the Edison website [1] and followed the instructions:

# include "mcu_api.h"

# include "mcu_errno.h"

# include

void mcu_main()

{

/* your configuration code starts here */

char buf[64];

int len;

while (1) /* your loop code starts here */

{

do {

len = host_receive((unsigned char *)buf, 64);

mcu_sleep(10);

} while (len <= 0);

if (strncmp(buf, "start", 5) == 0)

{

debug_print(DBG_INFO, "received start command!\n");

host_send((unsigned char*)"hello mcu\n", 10);

}

}

}

I get no output here either...

[1] https://software.intel.com/en-us/node/557354# Communicating_between_the_host_and_the_MCU Using the MCU SDK and API: Code examples | Intel® Developer Zone

idata
Community Manager
95 Views

Hi norm2782,

 

 

The snprintf has the same limitations. You can check this information in the following file available in the MCU installation directory: C:/[MCU directory]/docs/api_doc/html/mcu__api_8h.html

 

 

Regarding the example code you tested, make sure you are using /dev/ttymcu0 instead of /dev/ttymcu1.

 

 

Regards,

 

Diego
JJurr
Novice
95 Views

Hi Diego,

Thanks for the API link.

I did a completely clean install of my Edison. The example from the website then works fine. However, when I then upload a faulty program, I get no output even if I upload a working program again. It's like the MCU is stuck somehow (or crashed in a seemingly unobservable way).

I'll try some more experiments to narrow down where exactly things go wrong. It feels like the MCU implementation is still somewhat experimental, though

idata
Community Manager
95 Views

Hi norm2782,

 

 

Let us know what your results are.

 

 

Additionally, try testing the MCU using the previous image version just to check if you get the same behavior.

 

 

Regards,

 

Diego
Reply