Hello, there,
I'm working in a project that will use all therr UARTS in S32K144, and one of them will be used as a simple console, with custom print code - not libc printf.
At this point, I'm still using S32K144EVB, and I would like to use semihosting console - so I looked at the EVB schematics, and saw that PTC6 and PTC7 are connected to UART1_TX_TGTMCU_R and UART1_RX_TGTMCU_R nets, and to MK20DX128VFM5, which implements OpenSDA.
I patched my custom print code (which works with a regular UART adapter connected to EVB pins) to use UART1, and configured PTC6 and PTC7 as follows:
/* Tx pin configuration data */
.tx_pin_cfg.base = PORTC,
.tx_pin_cfg.pinPortIdx = 7U,
.tx_pin_cfg.pullConfig = PORT_INTERNAL_PULL_NOT_ENABLED,
.tx_pin_cfg.driveSelect = PORT_LOW_DRIVE_STRENGTH,
.tx_pin_cfg.passiveFilter = false,
.tx_pin_cfg.mux = PORT_MUX_ALT2,
.tx_pin_cfg.pinLock = false,
.tx_pin_cfg.intConfig = PORT_DMA_INT_DISABLED,
.tx_pin_cfg.clearIntFlag = false,
.tx_pin_cfg.gpioBase = NULL,
.tx_pin_cfg.digitalFilter = false,
/* Rx pin configuration data */
.rx_pin_cfg.base = PORTC,
.rx_pin_cfg.pinPortIdx = 6U,
.rx_pin_cfg.pullConfig = PORT_INTERNAL_PULL_NOT_ENABLED,
.rx_pin_cfg.driveSelect = PORT_LOW_DRIVE_STRENGTH,
.rx_pin_cfg.passiveFilter = false,
.rx_pin_cfg.mux = PORT_MUX_ALT2,
.rx_pin_cfg.pinLock = false,
.rx_pin_cfg.intConfig = PORT_DMA_INT_DISABLED,
.rx_pin_cfg.clearIntFlag = false,
.rx_pin_cfg.gpioBase = NULL,
.rx_pin_cfg.digitalFilter = false,
}
I alse have semihost enabled in project properties, and I'm using no IO newlib_nano, since I'm using a custom print code - not libc printf.
While debugging, however, I'm not getting anything in semihost console.
What am I missing here? What UART parameters (BAUD, nbits, parity, flow control) shouln I use?
Best regards,
Joao
Solved! Go to Solution.
Well, it turns out I was mixing up two completely different concepts: S32K144EVB does allow routing UART1 through OpenSDA - but that's not semihosting. When using semihosting, a real serial port of the MCU under debugging is not involved, and libc will talk directly to OpenSDA.
In fact, I've just 'found' a virtual COM in my debug PC, hooked a terminal emulator to it and bingo, it's working.
I imagine that this post could possible be useful for someone in teh future.
Thank you,
Joao
Hi,
The Semihosting console requires STD C library with I/O support - the output data aren't related to any UART port - it is GDB server/client feature.
Jiri
Nice. I'll give it a try ASAP.
And what about the serial parameters?
Thank you for your time,
Joao
Well, it turns out I was mixing up two completely different concepts: S32K144EVB does allow routing UART1 through OpenSDA - but that's not semihosting. When using semihosting, a real serial port of the MCU under debugging is not involved, and libc will talk directly to OpenSDA.
In fact, I've just 'found' a virtual COM in my debug PC, hooked a terminal emulator to it and bingo, it's working.
I imagine that this post could possible be useful for someone in teh future.
Thank you,
Joao