How to modify FreeRTOS to get my M4 output the Hello World example on my board?

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

How to modify FreeRTOS to get my M4 output the Hello World example on my board?

Jump to solution
3,527 Views
erikfriedel
Contributor III

Hi everyone,

I have a development board and already installed uboot and linux.

 

Problems starts while trying to work with the M4 coprocessor. I ran the hello world sample from FreeRTOS but the debug output UART3 (usually it is uart2 but it isn’t physically connected to the board) didn’t show anything than sometimes the characters “z”, ”°”, ”||” immediately after I boot up the M4.

To change from uart2 to uart3 I edited the board.h and the pin_mux.c file.

Board.h

/* Debug UART information for this board */

#define BOARD_DEBUG_UART_RDC_PDAP             rdcPdapUart3

#define BOARD_DEBUG_UART_CCM_ROOT             ccmRootUart3

#define BOARD_DEBUG_UART_CCM_CCGR             ccmCcgrGateUart3

#define BOARD_DEBUG_UART_BASEADDR             UART3

#define BOARD_DEBUG_UART_IRQ_NUM             UART3_IRQn

#define BOARD_DEBUG_UART_HANDLER             UART3_Handler

 

Pin_mux.c

void configure_uart_pins(UART_Type* base)

{

   switch((uint32_t)base)

   {

       case UART3_BASE:

           // UART3 iomux configuration

           IOMUXC_SW_MUX_CTL_PAD_UART3_RX_DATA = IOMUXC_SW_MUX_CTL_PAD_UART3_RX_DATA_MUX_MODE(0);

           IOMUXC_SW_MUX_CTL_PAD_UART3_TX_DATA = IOMUXC_SW_MUX_CTL_PAD_UART3_TX_DATA_MUX_MODE(0);

           IOMUXC_SW_PAD_CTL_PAD_UART3_RX_DATA = IOMUXC_SW_PAD_CTL_PAD_UART3_RX_DATA_PE_MASK |

                                                 IOMUXC_SW_PAD_CTL_PAD_UART3_RX_DATA_PS(3)   |

                                                 IOMUXC_SW_PAD_CTL_PAD_UART3_RX_DATA_HYS_MASK |

                                                  IOMUXC_SW_PAD_CTL_PAD_UART3_RX_DATA_DSE(0);

           IOMUXC_SW_PAD_CTL_PAD_UART3_TX_DATA = IOMUXC_SW_PAD_CTL_PAD_UART3_TX_DATA_PE_MASK |

                                                 IOMUXC_SW_PAD_CTL_PAD_UART3_TX_DATA_PS(3)   |

                                                 IOMUXC_SW_PAD_CTL_PAD_UART3_RX_DATA_HYS_MASK |

                                                 IOMUXC_SW_PAD_CTL_PAD_UART3_TX_DATA_DSE(0);

           IOMUXC_UART3_RX_DATA_SELECT_INPUT = IOMUXC_UART3_RX_DATA_SELECT_INPUT_DAISY(2);

           break;

       default:

           break;

   }

}

Is there anywhere else a file to modify to use uart3 instead of uart2 as debug_uart?

The code was successfully loaded via uboot from the emmc and tftp. In Linux, I am able to output an echo to the UART3 so the problem isn’t due to hardware issues.

I can debug over JTAG via an Amontec JtagKey-Tiny and I can read registers of both the A7 and the M4 via OPENOCD.

I already checked out this thread https://community.nxp.com/message/984055 but it isn’t solved completely.

So the only option I see is, that the FreeRTOS needs special configuration or that the uboot disables the uart access to the M4.

 

How can I output something on my M4?

Labels (1)
1 Solution
3,010 Views
igorpadykov
NXP Employee
NXP Employee

Hi Eric

one can check if uart3 clocks are properly configured, seems it is in  ..examples//imx7d_sdb_m4/clock_freq.c

Best regards
igor

View solution in original post

6 Replies
3,010 Views
igorpadykov
NXP Employee
NXP Employee

Hi Erik

one can try to use kernel boot parameter uart_from_osc

described in Table 11. Common kernel boot parameters attached Release Notes.

Also on i.MX7D Sabre board uart3 was used for sai3:

linux/arch/arm/boot/dts/imx7d-sdb.dts

linux-imx.git - i.MX Linux Kernel 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
3,010 Views
erikfriedel
Contributor III

Hi Igor

thank you for your response.

I tried the kernel boot parameter uart_from_osc but Uboot said it isn't defined.

And I don't think the problem is in the Linux kernel, due to the fact that Linux isn't even loaded. I just start the M4 after booting into UBoot.

I tried using the standard uart2 but only one pin (sadly the UART_RX) is accessible on this particular board, so I can't check if the uart is the problem.

I can read with openocd that the code was successfully loaded to the target address. But the console shows nothing again.

Thanks for help

Erik

0 Kudos
Reply
3,011 Views
igorpadykov
NXP Employee
NXP Employee

Hi Eric

one can check if uart3 clocks are properly configured, seems it is in  ..examples//imx7d_sdb_m4/clock_freq.c

Best regards
igor

3,010 Views
erikfriedel
Contributor III

Thank you very much!!! I got this problem for days now and thanks to your help I can finally go on!

Best regards

Erik

0 Kudos
Reply
3,010 Views
erikfriedel
Contributor III

Hi Igor

It looks like I didn't change uart2 to uart3 here. So chances are good it's gonna work for me with that change.

I give it a try and tell what happened later.

Thank you for your help

Erik

0 Kudos
Reply
2,976 Views
kalai
Contributor I
hi, i need to excute UART3 so what we have to change in freertos code please could share the details thanks kalai
0 Kudos
Reply