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

このサイトに掲示されているすべてのコンテンツと資料は、「そのままの状態」で提供されます。サイプレス セミコンダクタとその関連サプライヤは、これらの資料について、いかなる目的への適合性をも表明することはありません。また、これらの資料について、すべての保証や条件を放棄します。これには、暗示的な保証および条件、商用性、特定の目的への適合性、すべてのサードパーティの知的財産権に対する権利と非侵害などが含まれますが、これらに制限されることはありません。サイプレス セミコンダクタにより、明示または暗示にかかわらず、禁反言などによるライセンスは、付与されないものとします。このサイトに掲示されている情報の使用には、サードパーティまたはサイプレス セミコンダクタからのライセンスが必要となる場合があります。

このサイトのコンテンツには、特定のガイドラインや使用制限が含まれている場合があります。このサイトにおけるすべての掲示やコンテンツの使用は、サイトの利用規約に準じて行われるものとします。このコンテンツを使用するサードパーティは、制限やガイドラインに従い、このサイトの利用規約を遵守するものとします。サイプレス セミコンダクタとそのサプライヤは、コンテンツや資料、その製品、プログラム、サービスに対し、いつでも修正、削除、変更、改善、向上、その他の変更を加える権利を有します。また、いかなるコンテンツ、製品、プログラム、サービスを予告なく変更または閉鎖する権利を有します。