Percepio Tracealyzer - Analyzing the PSoC Tracealyzer Streamport | Cypress Semiconductor
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.
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.
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.
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.
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.
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
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.
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
ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.
Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.
Comments
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.
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
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.
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.
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
Good Post
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
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
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
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.
informasi yang sangat membantu
very nice post
titan gel
penirum
hammer of thor
thanks for your artikel.. i like and very nice.
pembesar penis
obat pembesar penis
cara membesarkan penis
Thank you very much this post is really helpful
aplikasi kasir online omegasoft