You are here

Percepio Tracealyzer - Analyzing the PSoC Tracealyzer Streamport | 赛普拉斯半导体

Percepio Tracealyzer - Analyzing the PSoC Tracealyzer Streamport

[re-printed from https://iotexpert.com]

In the previous article I showed you how to make a PSoC Tracealyzer Streamport using the SCB based UART on a PSoC 4200M. It didn’t take long for me to realize that 115200 baud was not going to cut it. That realization lead me to figure out that the KitProg on the CY8CKIT-044 was limited to 115200, which I worked around by using the Cypress USB Serial Bridge that I got from the CY8CKIT-049.  But when I look at the CPU graph I found out that it took 50% of the CPU to support streaming the data.  So now what?  In this Article lets analyze the data, both old school with a logic analyzer, and new school with PSoC Tracealyzer.

Analyzing the PSoC Tracealyzer Data

While I was capturing the streaming data from PSoC Tracealyzer I could see that the CPU was burning about 50% of the time just running the TzCntrl and blinking LED thread.  That isn’t good.

CY3295 Kit Image

 

When you look at the PSoC Tracealyzer trace viewing you can see the problem is the TzCtrl task.  This task is running for 83 milliseconds and using 57.6% of the CPU.

CY3295 Kit Image

 

If you look at the data transmit function called “PSoC_Transmit”, there isn’t much going on.  Just a call to UART_SpiUartPutArray.  But if you look at the UART documentation you will find that SpiUartPutArray is a blocking function, meaning it doesn’t return until it is done.  If you calculate the time to transfer a block of 1024 bytes at 8bits/byte and 230400 baud you will find that just sending the data takes 35ms.

int32_t PSoC_Transmit(void* data, uint32_t size, int32_t *numOfBytesSent )
{
    timing_Write(1);
    UART_SpiUartPutArray((uint8_t *)data,size);
    *numOfBytesSent=size;
    timing_Write(0);
    return 0; // Doesnt matter what you return... i dont think that it is checked
}

I was not very sure why the task was taking 83 milliseconds to run when the data transfer was only taking 40ms. To figure this out I added a toggle pin to the data write routine, just to make sure. What I found is the data write routine is getting called about every 70ms takes ~30ms to run.

CY3295 Kit Image

 

How is that possible, the calculation says that it should take 35ms.  It turns out that I configured the UART to have a 64 byte buffer.

CY3295 Kit Image

 

When you remove the 64 bytes from the calculation you end up with 32ish milliseconds.  The other thing that this chart shows is that the TzCntrl task is calling the PSoC_Transmit function more frequently that I thought, at least twice per cycle.  You can also see from the plot that function is taking 30/70=42.8% of the CPU by itself.  Not good, but we are starting to understand what is going on.

As I typed this part of the Article I realized that toggling a GPIO probably wasn’t the best way to figure out what was happening.  In fact, that is the whole point of Tracealyzer, that is analyzing the performance of your program.  When I looked at the Tracealyzer documentation (I always hate doing that), I found a nice function called vTracePrintf.  I added a “toggle” aka printing a 0 and printing a 1 into trace channel 0.

int32_t PSoC_Transmit(void* data, uint32_t size, int32_t *numOfBytesSent )
{
    timing_Write(1);
    vTracePrintF(0,"1");
    UART_SpiUartPutArray((uint8_t *)data,size);
    vTracePrintF(0,"0");
    timing_Write(0);
    *numOfBytesSent=size;
    
    return 0; // Doesnt matter what you return... i dont think that it is checked
}

After running another trace, look what I get.  You can see the “1” printing at the start and the 0 printing at the end.

CY3295 Kit Image

 

Even better, when I double clicked on the “[Default Channel] 0” it took me to this nice screen which shows when the events occurred.  The one that I clicked on started at 8.136.039 and ended at 8.176.176, in other words it took about 40ms

CY3295 Kit Image

 

After hand calculating the time, I realized that once again I should have done something even more obvious, let the ARM calculate the time.  the vTracePrintf will let you specify the output format, in this case a %d

int32_t PSoC_Transmit(void* data, uint32_t size, int32_t *numOfBytesSent )
{
    TickType_t time;
    
    timing_Write(1);
    
    time = xTaskGetTickCount();
    UART_SpiUartPutArray((uint8_t *)data,size);
    time = xTaskGetTickCount() - time;
    vTracePrintF(0,"%d",time);
    timing_Write(0);
    *numOfBytesSent=size;
    
    return 0; // Doesnt matter what you return... i dont think that it is checked
}

When you look at the trace, you need to click on the “User Events” to see the print outs from the trace.

CY3295 Kit Image

 

Now that we have a pretty good feel for what is going on, how do we fix it?  Simple, use the PSoC DMA take the CPU mostly out of the UART transmission path, which is the topic of the next Article.

As always you can find all of these projects on the IotExpert GitHub site or git@github.com:iotexpert/PSoC-Tracelyzer.git

 

Blog: 

Comments

abigailbreslin02_2705736's picture

There have been heaps of thoughts put on the table for the new advancement of IOS PSOC 6 yet the arrangement incorporates and the execution requires some time. IDES have codes which are difficult to comprehend and take a shot at so the engineer would be requiring some outsource Cheap Custom Essay at EssayStar.co.UK from an alternate master who has involvement or have chip away at the same PSOC rendition. it will enable the things to complete quick and in an appropriate way.

randdurjohngar1978_2685546's picture

Hi,

Thank you for the really informative and interesting post!

You awesome posts help me to understand the process. Thanks for that!

Best Regards,

Rad

Colin Cooper's picture

This specific Cheap Christian Louboutin style of shoes, which as popular today as it was then, has actually been around for many centuries. Due to the fact that there are so many locations to shop for Christian Louboutin, discovering a wonderful set has never ever been simpler.

elianahermione3050_2746526's picture

New progression of IOS PSOC 6 yet the course of  Essay Time  action joins and the execution requires some time. IDES have codes which are hard to grasp and tackle so the specialist would be requiring some outsource  from an other ace who has contribution or have wear down the same PSOC version. it will empower the things to finish fast and in a proper way.

axaberry85_2764276's picture

Many thanks for sharing this very diverse opinion post where each expert has no doubt shared his best knowledge on the topic. Have more success in your journey.

management assignment help

csjoshi.editsoftdigital_2593831's picture

Good Post

normensilalahi_2960966's picture

Bagi anda yang sedang hamil dan ingin menggugurkan kandungan anda bisa membeli obat aborsi untuk menggugurkan kandungan dengan cepat dan aman, kalau anda ingin membeli obat aborsi anda bisa membeli di website kami. obat gugur kandungan kalau anda ingin melihat cara menggugurkan kandungan anda bisa melihat cara nya disini. baca keterangan disini

normensilalahi_2960966's picture

Jual obat perangsang wanita alami yang berkhasiat untuk membangkitkan gairah seks pada pasangan dengan cepat dan aman, bagi anda yang berminat ingin membeli obat perangsang wanita silahkan untuk mengunjungi website kami. cara merangsang wanita dan apabila anda ingin membaca tenatng cara merangsang wanita anda bisa mengunjungi website kami disini. obat perangsang pria dan kami juga menyediakan produk potenzol untuk merangsang pria dan wanita untuk informasi pemesanan silahkan baca di website. obat potenzol cair Jual obat kuat pria yang bermerek viagra yang berguna untuk menambah stamina pria dan juga untuk mengobati impoten untuk informasi pemesanan bisa mengunjungi website kami. jual viagra asli dan kalau anda ingin cek keaslian produk silahkan untuk cek keaslian produk di website kami. obat viagra Kami juga menyediakan produk obat tidur alami yang sangat aman utnuk digunakan sebagai cara mengobati susah tidur untuk informasi pemesanan bisa mengunjungi website kami. jual obat bius cair dan kalau Anda ingin membeli obat bius kami juga menjual produk obat penghilang kesadaran yang sangat mujarab untuk informasi pemesanan sialhakn mengunjungi situs kami. obat bius pingsan

randdurjohngar1978_2685546's picture

Hi,

Thank you for the really informative and interesting post!

I noticed that on this website I found a lot of interesting tricks.

You awesome posts help me to understand the process. Thanks for that!

Best Regards,

Rad

grosirkaospolos79_3063561's picture

dapatkan kaos polos bandung murah hanya di toko grosir kaos polos bandung. Harga kami di jamin terbaik dan tak lupa kualitas bahan kaos oblong di kami tentunya menggunakan cotton combad 30S yang nyaman di kenakan. Kami hanya jual kaos polos atau kaos oblong dengan kualitas terbaik saja titik. 0857 980 60608 - jual kaos oblong.

 

titangelrsa_3087786's picture

informasi yang sangat membantu

very nice post

titan gel

penirum

​hammer of thor

agenliga69_3182556's picture

thanks for your artikel.. i like and very nice.

pembesar penis 

obat pembesar penis 

cara membesarkan penis

hudadepascho_3248776's picture

Thank you very much this post is really helpful

aplikasi kasir online omegasoft

本网站上的所有内容和材料均“按原样”提供。赛普拉斯半导体公司及其各个供应商对这些材料用于任何用途的适用性不作陈述,并且对关于这些材料的所有担保和条件概不负责,包括但不限于有关适销性、针对特定用途之适用性、权利和不侵犯任何第三方知识产权的所有暗示担保和条件。赛普拉斯半导体公司不授予任何明示或暗示的许可(无论是以默许方式或是任何其他方式)。使用本网站上的信息可能需要第三方的许可,或赛普拉斯半导体公司的许可。

本网站上的内容可能包含或必须遵守关于使用的特定准则或限制。所有帖子和使用本网站上的内容都必须遵守本网站的条款与条件;使用这些内容的第三方必须同意遵守任何限制或准则,并遵守本网站的条款与条件。赛普拉斯半导体公司及其供应商保留随时对内容和材料、产品、计划和服务进行纠正、删除、修改、增强、改进或其他变更,或者移动或终止任何内容、产品、计划或服务的权利,恕不另行通知。