Reply
Posts: 30
Registered: ‎06-28-2017

USART bandwith Use ratio is quite low

I am testing the performance of TX of USART on EFM32PG12b, and find that Bandwith Use ratio is quite low. Please look at the test result below:

 

 Baudrate(Mbits/s)Data length(Bytes)Rate(KBytes/s)Rate(KBits/s)Bandwith Use ratio(%)
USART_Tx110244233637.8
USART_Tx210247056031.5
USART_Tx2.410247660828.5
USART_Tx4102410684823.85
USART_Tx81024141112815.8625
USART_Tx91024142113614.2

 

 

Posts: 75
Registered: ‎09-03-2015

Re: USART bandwith Use ratio is quite low

Hi @netprince

 

Have you done similar tests with the use of LDMA to transfer data over USART? Can you provide a link to the source code for these benchmarks?

 

Are you doing UART or SPI transfers in these tests? When sending UART data there are start and stop bits that are sent for each byte which might effect your test results.

 

Posts: 30
Registered: ‎06-28-2017

Re: USART bandwith Use ratio is quite low

FYI.

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

uint32_t msTicks_start, msTicks_end, msTicks_diff;
unsigned int rate;

 

int perf_rs485_send(int byteNum)
{
    perf_monitor_start();
    UART_Tx_block(flashData, byteNum);
    perf_monitor_end(byteNum);
    return 0;
}

 

void perf_monitor_start()
{
    msTicks_end = msTicks;
    while(msTicks_end==msTicks);    //msTicks Sync

    msTicks_start = msTicks;
}

void perf_monitor_end(uint32_t size)
{
    msTicks_end = msTicks;
    msTicks_diff = (msTicks_end-msTicks_start);

    rate = size/msTicks_diff*1000;    //end*32000*msTicks_diff/1000;
    printf("Done: %8u/s, %4dns, msTicks %u-%u = %u\r\n", rate, (int)((1000*1000*1000)/rate),
            (unsigned int)msTicks_end, (unsigned int)msTicks_start, (unsigned int)msTicks_diff);
}

 

void USART_Tx_block(uint8_t *data, uint32_t byteNum) {
    while (byteNum>0)
    {
        USART_Tx( USART3, *(uint8_t*)data );
        byteNum  --;
        data ++;
    }

}

 

Highlighted
Posts: 3,100
Registered: ‎02-07-2002

Re: USART bandwith Use ratio is quite low

You didn't answer UART or SPI.

Posts: 561
Registered: ‎09-18-2015

Re: USART bandwith Use ratio is quite low

Hi @netprince,

 

Like @vanmierlo said: Synchronous or Asynchronous?

 

In synchronous mode, I get 128 KB/sec at 1 Mbps.

 

In asynchronous mode (8N1), I get 102 KB/sec at 1 Mbps.

 

That's running your USART_Tx_block() unchanged, too.

 

You're software looks to be doing something that you don't know about, and since you didn't provide the whole code listing, we can't really tell.

 

John

Posts: 30
Registered: ‎06-28-2017

Re: USART bandwith Use ratio is quite low

it is UART.

Posts: 248
Registered: ‎11-17-2013

Re: USART bandwith Use ratio is quite low

If you have a lot of background interrupt processing - the only reason I can think of that explain your results - try using DMA for USART output.