i.MX7D SoC is a dual core Cortex-A7 and an additional Cortex-M4. The iMX7D sabre board exposes two debug UART ports when connected to PC: 1) for Cortex-A 2) for Cortex-M. By looking at the schematic, it is easy to figure out that Sabre evaluation board uses UART 2 as the debug port for Cortex-M. However, how to figure out on a custom SoM based on iMX7d uses which UART port for Cortex-M4. This was the mystery of today, which took me a while to figure out. Our BSP provider told us that, the UART port is not fixed for Cortex-M4 and any UART our of UART1 to UART7 can be used for M4. Since 1 of the UART is already in use by A7, there are remaining 6 UARTs. Now how to tell M4 to use one of the UART out of this? Initially I thought there may be some setting in the UART block, but that is not the case. I tried to figure out the answer in Technical Reference Manual, but no luck there as well.
Then I tried to see the FreeRTOS sample code, which is the actual code that runs on M4. And bingo, FreeRTOS sample code contains the UART port initialization. It configures the UART port 2 as debug console, so not at all portable for other custom platforms. There are three things which need to be changed:
- Default console macros
- pinmux for custom selected UART
- clock setting for custom selected UART
With these changes I could get the debug prints from M4 core on different UART than UART2.
Again, writing this down, so that I don’t have to start the exploration session again.