I.MX6 SoloX M4 Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I.MX6 SoloX M4 Problem

Jump to solution
11,102 Views
nathanb_
Contributor III

Hello Everyone,

I'm currently evaluating an I.MX6SX SDB and have managed to boot Linux on the A9 and a demo application on the M4.

If I boot the M4 application via 'run m4boot' in u-boot before Linux is booted, the input/output on the M4 side seems fine at 115200 baud on the FTDI usb-serial debug port.


***** MCC Virtual TTY EXAMPLE *****

Please wait :

    1) A9 peer is ready

Then press "S" to start the demo

********************************

Press "S" to start the demo :

However -- As soon as the A9 core starts running Linux, any input/output on the M4 side looks like gibberish.  It's as if the baud rate is no longer set to 115200.

For example if I press 'S' before issuing the boot command in u-boot (to start Linux) the response is "Responder task started, MCC version is 002.000" from the M4

If I press 'S" after Linux is booting, I get no response and the S does not appear as an 'S' in Teraterm.  Again, it's as if the S isn't making it through because the baud rate is mangled.

Does anyone have any idea what's going on here?

Thanks

Labels (3)
1 Solution
6,506 Views
nathanb_
Contributor III

Hello Everyone,

I've solved the issue.

When the processor is first powered on, the CCM Serial Clock Divider Register at 0x20C4024 is set to 0x00490B40.  This means that the uart_clk_sel is being set to use osc_clk.

When Linux boots, the device tree is setting it to 0x00490B00.  This means that the uart_clk_sel is being set to use pll3_80m as its clock.

In the 3.10.53 kernel (root/arch/arm/mach-imx/clk-imx6sx.c), there is a conditional that states:

if (uart_from_osc)
      imx_clk_set_parent(clks[IMX6SX_CLK_UART_SEL], clks[IMX6SX_CLK_OSC]);
else
      imx_clk_set_parent(clks[IMX6SX_CLK_UART_SEL], clks[IMX6SX_CLK_PLL3_80M]);

So, uart_from_osc needs set true to make the M4 and A9 uart clock selections match.

This is a u-boot parameter that can be added to the mmcargs/bootargs environment variable.

Example:

setenv mmcargs 'setenv bootargs uart_from_osc console=${console},${baudrate} root=${mmcroot}'

View solution in original post

20 Replies
6,503 Views
peralesserrano
Contributor I

TY nathan, I'll keep looking to see if I assure you it is possible to program the M4

hi JAVIER

yes, if it helped me,it is valid for all the family i.mx,

you can buy a evaluation board and try to stay calmer, but the document does not explain anything imx6Sx M4 cortex.

an inexpensive board is for example:

https://www.olimex.com/Products/OLinuXino/iMX233/iMX233-OLinuXino-NANO/open-source-hardware

0 Kudos
Reply
6,509 Views
SergioSolis
NXP Employee
NXP Employee

Thank you for posting the solution, it will greatly help increase the knowledge base of the communities!

0 Kudos
Reply
6,509 Views
nathanb_
Contributor III

To clarify this issue a little more.  I wrote a program on the M4 which prints "Hello World" every 100 ms.  I then set u-boot to automatically start the M4 and the A9.  The M4 starts first.

What I see when turning the board on is:

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

Hello World

ÈùÙloùÙ

ÈùÙÈùÙÈùÙÈùÙÈùÙÈùÙ

   ÈùÙÈùÙÈùÙÈùÙÈùÙÈùÙ

ÈùÙ                  ÈùÙÈùÙÈùÙÈùÙÈùÙÈùÙ

ÈùÙÈùÙÈùÙÈùÙÈùÙÈùÙ

   ÈùÙÈùÙÈùÙÈùÙÈùÙÈùÙ

ÈùÙÈùÙÈùÙÈùÙ         ÈùÙ

   ÈùÙÈùÙÈùÙÈùÙÈùÙÈùÙ

ÈùÙ                  ÈùÙÈùÙÈùÙÈùÙÈùÙ

ÈùÙÈùÙÈùÙÈùÙÈùÙÈùÙ

The gibberish repeats indefinitely.  Changing baud rates does not fix the issue.

0 Kudos
Reply
6,509 Views
niranjanbc
Contributor IV

Hi Nathan,

i have updated mmcargs in u-boot as mentioned above. but still i have problem.

m4 stops printing the message. is that because we are using different pads for UART2.

SW_PAD_CTL_PAD_SD1_DATA0 for UART2 RX

SW_PAD_CTL_PAD_SD1_DATA1 for UART2 TX

where should i update these details.

thanks

Niranjan

0 Kudos
Reply
6,509 Views
niranjanbc
Contributor IV

got the issue fixed, had to update device tree file and comment out SW_PAD_CTL_PAD_SD1_DATA0 and SW_PAD_CTL_PAD_SD1_DATA1 pincntl in imx6sx-sdb.dts file.

0 Kudos
Reply
6,507 Views
nathanb_
Contributor III

Hello Everyone,

I've solved the issue.

When the processor is first powered on, the CCM Serial Clock Divider Register at 0x20C4024 is set to 0x00490B40.  This means that the uart_clk_sel is being set to use osc_clk.

When Linux boots, the device tree is setting it to 0x00490B00.  This means that the uart_clk_sel is being set to use pll3_80m as its clock.

In the 3.10.53 kernel (root/arch/arm/mach-imx/clk-imx6sx.c), there is a conditional that states:

if (uart_from_osc)
      imx_clk_set_parent(clks[IMX6SX_CLK_UART_SEL], clks[IMX6SX_CLK_OSC]);
else
      imx_clk_set_parent(clks[IMX6SX_CLK_UART_SEL], clks[IMX6SX_CLK_PLL3_80M]);

So, uart_from_osc needs set true to make the M4 and A9 uart clock selections match.

This is a u-boot parameter that can be added to the mmcargs/bootargs environment variable.

Example:

setenv mmcargs 'setenv bootargs uart_from_osc console=${console},${baudrate} root=${mmcroot}'

6,509 Views
sublime
Contributor III

Hi Nathan,

I am trying to run hello world on my solox sabresd board.

I am using Eclipse IDE and when I compile the code I get a .elf file:

10:57:41 **** Incremental Build of configuration Release for project helloworldtest ****

make all

Invoking: Cross ARM GNU Print Size

arm-none-eabi-size --format=berkeley "helloworldtest.elf"

   text   data    bss    dec    hex filename

   8252   2396    260  10908   2a9c helloworldtest.elf

Finished building: helloworldtest.siz

10:57:43 Build Finished (took 2s.387ms)

Code:

/*

============================================================================

Name        : main.c

Author      :

Version     :

Copyright   : Your copyright notice

Description : Hello World in C

============================================================================

*/

#include <stdio.h>

/*

*

* Print a greeting message on standard output and exit.

* On embedded platforms this might require semi-hosting or similar.

* For example, for toolchains derived from GNU Tools for Embedded,

* to enable semi-hosting, the following was added to the linker:

*

* --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lc -lm -lrdimon -Wl,--end-group

*

* Adjust it for other toolchains.

*

*/

int

main(void)

{

  printf("Hello ARM World!" "\n");

  return 0;

}

My question is how can I get hello world to print?

Thanks.

0 Kudos
Reply
6,509 Views
nathanb_
Contributor III

Javier,

You have to turn the elf into a bin

Cortex_M4/toolchain/gcc-arm-none-eabi-4_9-2015q1/arm-none-eabi/bin/objcopy -O binary hello_world.elf m4_qspi.bin

Then copy m4_qspi on to the sdcard's first partition (where all the *.dtb files and zImage sits)

Then stop u-boot and "run update_m4_from_sdcard"

Then run "run m4boot"

6,509 Views
sublime
Contributor III

Thanks Nathan. I was able to follow your instructions and created the m4_qspi.bin file.

However, I do not see Hello World in the PuTTY terminal window.

Below is the terminal window output:

=> run update_m4_from_sd

SF: Detected N25Q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB

reading m4_qspi.bin

43420 bytes read in 29 ms (1.4 MiB/s)

SF: 65536 bytes @ 0x0 Erased: OK

SF: 43420 bytes @ 0x0 Written: OK

=> run m4boot

SF: Detected N25Q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB

## Starting auxiliary core at 0x78000000 ...

=>

0 Kudos
Reply
6,509 Views
nathanb_
Contributor III

Javier,

When you plug in the USB debug cable into the SoloX, two communication ports are populated.  The communication port you are talking in to is for the A9.  Once you type "run m4boot," you should see the, "Hello World" come out of the OTHER communication port (for the M4).

For example, I run two teraterm windows and connect one to COMM5 and one to COMM4.  Both communication ports are set to 115200 baud with no flow control.  When I type "run m4boot" on the COMM4 window, I see "Hello World" on the COMM5 window.

Are you doing this?

6,509 Views
tonioch
Contributor III

Hi Nathan ,

First of all, thanks for your help and your time.

I'm currently working on the iMX6SX and I wanna test different use case (IDLE mode, Deep Sleep mode,...) in order to do some power consumption measurements. The first step to enter in a mode is to load the M4's image to QSPI and then to boot from it.

So, first, I've tried to run the hello world's binary file you've shared in your post.

I did just like you suggested: 'run update_m4_from_sd' then 'run m4boot' and it works. However, nothing is displayed on the M4's side.

Could you please help me? Is there anything I've forgotten?

Sincerely

0 Kudos
Reply
6,509 Views
nathanb_
Contributor III

Newer kernel and u-boot versions may have some memory locations moved.  I believe it was built for imx_3.10.53_1.1.0_ga and imx_v2014.04_3.10.53_1.1.0_ga.

0 Kudos
Reply
6,505 Views
tonioch
Contributor III

I'm using the 3.10.53_1.1.0_ga Linux version so it should work...

I just have to flash the QSPI NOR with the .bin with run update_m4_from_sd and then boot the M4, right?

Do you still have the M4's demo application ? Otherwise, could you tell me where to find it?

Thanks a lot,

Antoine

0 Kudos
Reply
6,505 Views
nathanb_
Contributor III

m4_qspi.bin is still available at the link I gave to Perales above.

It sounds to me like you're doing the proper steps.  I'm not sure what else could be going on, sorry.

0 Kudos
Reply
6,505 Views
sublime
Contributor III

nathanb.

Thanks for telling me to check the other com port. I opened another terminal window with the settings you mentioned and the M4 terminal is not printing Hello ARM World.

At this point, I think my setting in Eclipse are not correct. In particular, I believe I should be selecting device for the memory map. But I have no devices installed on my Eclipse.

Do you have any other ideas of what I could be doing wrong? Would you be able to provide me with your hello_world.bin file so that I may run on my setup?

Thanks so much for your help,

Javier

0 Kudos
Reply
6,509 Views
nathanb_
Contributor III

Javier,

Maybe your cross compiler isn't properly set up.  I'm not sure.  Try my file from the link below:

http://www.filedropper.com/m4qspi

6,509 Views
peralesserrano
Contributor I

hi Nathat,

the file is broken can back up please.

I want to start using i.mx6solox for my projects, but I do not want to use DS5 and Jlink

I can work with Cortex A9 and M4 in eclipse for free?

there is much documentation such as:

http://cache.freescale.com/files/32bit/doc/app_note/AN4553.pdf?fasp=1&WT_TYPE=Application%20Notes&WT...

but I can not find how to program, debug and run load in cortex M4.

is this possible everything from eclipse for free?

is there any document that explains how to do?

thank you very much for the help

0 Kudos
Reply
6,509 Views
sublime
Contributor III

Hi Perales,

Was the document helpful? (Using Open Source Debugging Tools for Linux on i.MX Processors)

Were you able to set up your toolchain? Are you able to program the A9?

I am also in the same situation.

nathanb.  Thanks for the binary file. I was able to run the Hello World on my board. Are you using Yocto to build the Hello World program?

0 Kudos
Reply
6,509 Views
nathanb_
Contributor III

No, I was using the cross compiler from https://launchpad.net/gcc-arm-embedded

0 Kudos
Reply
6,509 Views
nathanb_
Contributor III

Perales,

You can download the file at:

http://bytefull.com/IMX6SX/m4_qspi.bin

You should be able to do everything under eclipse.  I have not done it myself yet, so I have no documents to explain how.

As far as debugging for free, I'm not sure how viable this is on the M4.  A JTAG debugger is going to be the easiest option.

0 Kudos
Reply