issue of arch_printf()

Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
Last seen: 2 months 1 week ago
Joined: 2017-12-06 09:24
issue of arch_printf()

I'm using UART1 as logging output.

Due to RAM size, I have to configure to use UART1(ROM).

Here is the config of UART1:

// Configuration struct for UART
static const uart_cfg_t uart_cfg = {
    // Set Baud Rate
    .baud_rate = UART_BAUDRATE_115200,
    // Set data bits
    .data_bits = UART_DATABITS_8,
    // Set parity
    .parity = UART_PARITY_NONE,
    // Set stop bits
    .stop_bits = UART_STOPBITS_1,
    // Set flow control
    .auto_flow_control = UART_AFCE_DIS,
    // Set FIFO enable
    .use_fifo = UART_FIFO_EN,
    // Set Tx FIFO trigger level
    .tx_fifo_tr_lvl = UART_TX_FIFO_LEVEL_0,
    // Set Rx FIFO trigger level
    .rx_fifo_tr_lvl = UART_RX_FIFO_LEVEL_0,
    // Set interrupt priority
    .intr_priority = 2,
#if defined (CFG_UART_DMA_SUPPORT)
    // Set UART DMA Channel Pair Configuration
    .uart_dma_channel = UART_DMA_CHANNEL_01,
    // Set UART DMA Priority
    .uart_dma_priority = DMA_PRIO_0,


DMA is not enabled.

when i use arch_printf():

if the final output char <=17,it works well.

if the final output char >17,it then can only output 17 ASCII char,and then no print can be sent out any more.

I think it's probably related to the FIFO size of UART(16),but i can't see the Rom code and analyze this issue.

Please help.


Last seen: 1 year 4 months ago
Joined: 2016-09-19 23:20
Hi Kevinchen_sz,

Hi Kevinchen_sz,

The ROM code is a closed source and not available to view. You are correct about the fifo size.

Since we cannot modify the ROM code, you can implement wrap up functions to implement the required length for your logs.

You could also implement custom routines and bypass the UART1 functions in the ROM, but that would require updating the jump tables and handling the register configuration. Which is not recommended unless absolutely necessary.

Having said that, the API itself doesn't use up much RAM space. Are you using the UART2 for any other interface.

If not, I would first try to use the UART2 module and see if that really uses up the RAM.