{"id":2914,"date":"2021-04-24T14:11:23","date_gmt":"2021-04-24T12:11:23","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=2914"},"modified":"2021-04-25T17:08:03","modified_gmt":"2021-04-25T15:08:03","slug":"using-the-rasperry-pico-pio-as-logical-analzyer","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/","title":{"rendered":"The Rasperry Pico PIO for my Logical Analzyer: Some Tests"},"content":{"rendered":"<p>I have a first DRAFT version for the Pico PIO implementation of the PicoCapturePIO capturing class for my <a href=\"https:\/\/github.com\/pschatzmann\/logic-analyzer\">Arduino Logic Analyzer Library<\/a> ready and started to run some tests.<\/p>\n<p>The <a href=\"https:\/\/github.com\/pschatzmann\/logic-analyzer\/tree\/main\/examples\/logic-analyzer-test\">Test Sketch<\/a> is part of the project and can be found in the examples forlder.<\/p>\n<p>I was using a PWM signal with a duty cycle of 60% in order to be able verify the measuring.<\/p>\n<p>Here are my results:<\/p>\n<h2>Capturing in a loop with micros() delays<\/h2>\n<p>In my standard implementation I was doing the capturing in a simple loop and used some delays to measure at different frequencies:<\/p>\n<pre><code>testing 50000 -&gt; 52339.48 using delay microsec 19 duty cycle: 59.91 =&gt; OK \ntesting 100000 -&gt; 104471.05 using delay microsec 9 duty cycle: 59.89 =&gt; OK \ntesting 200000 -&gt; 247247.77 using delay microsec 4 duty cycle: 59.92 =&gt; OK \ntesting 300000 -&gt; 494488.09 using delay microsec 2 duty cycle: 59.86 =&gt; OK \ntesting 400000 -&gt; 630186.63 using delay microsec 1 duty cycle: 60.02 =&gt; OK \ntesting 500000 -&gt; 630277.56 using delay microsec 1 duty cycle: 59.88 =&gt; OK \ntesting 600000 -&gt; 654316.19 using delay microsec 0 duty cycle: 59.97 =&gt; OK \ntesting 700000 -&gt; 654512.25 using delay microsec 0 duty cycle: 59.98 =&gt; OK \n<\/code><\/pre>\n<p>We can measure up to <strong>654&#8217;316 Hz.<\/strong><\/p>\n<h2>Capturing in a loop w\/o delays<\/h2>\n<p>A simple loop w\/o delays will run much faster:<\/p>\n<pre><code>testing max speed \ntime us:26126.00\nsample count:65535\nmax speed: 2508420.75\n\n<\/code><\/pre>\n<p>We can measure up to <strong>2&#8217;508&#8217;420 Hz<\/strong> !<\/p>\n<h2>Capturing with the PIO<\/h2>\n<p>Here are the results using the new PicoCapturePIO class:<\/p>\n<pre><code>testing 50000 -&gt; 50109.30 hz \/ divider: 2494.69 duty cycle: 59.91 =&gt; OK \ntesting 100000 -&gt; 100218.22 hz \/ divider: 1247.34 duty cycle: 59.89 =&gt; OK \ntesting 200000 -&gt; 200434.30 hz \/ divider: 623.67 duty cycle: 59.97 =&gt; OK \ntesting 300000 -&gt; 300652.38 hz \/ divider: 415.78 duty cycle: 59.99 =&gt; OK \ntesting 400000 -&gt; 400869.81 hz \/ divider: 311.84 duty cycle: 59.87 =&gt; OK \ntesting 500000 -&gt; 501085.75 hz \/ divider: 249.47 duty cycle: 59.97 =&gt; OK \ntesting 600000 -&gt; 601293.69 hz \/ divider: 207.89 duty cycle: 59.89 =&gt; OK \ntesting 700000 -&gt; 701516.81 hz \/ divider: 178.19 duty cycle: 59.71 =&gt; OK \ntesting 800000 -&gt; 801749.44 hz \/ divider: 155.92 duty cycle: 59.87 =&gt; OK \ntesting 900000 -&gt; 901940.56 hz \/ divider: 138.59 duty cycle: 60.38 =&gt; OK \ntesting 1000000 -&gt; 1002171.50 hz \/ divider: 124.73 duty cycle: 59.96 =&gt; OK \ntesting 10000000 -&gt; 10020642.00 hz \/ divider: 12.47 duty cycle: 57.39 =&gt; OK \ntesting 20000000 -&gt; 20041284.00 hz \/ divider: 6.24 duty cycle: 65.35 =&gt; ERROR\ntesting 30000000 -&gt; 30048144.00 hz \/ divider: 4.16 duty cycle: 62.45 =&gt; OK \ntesting 40000000 -&gt; 40082568.00 hz \/ divider: 3.12 duty cycle: 60.45 =&gt; OK \ntesting 50000000 -&gt; 50064936.00 hz \/ divider: 2.49 duty cycle: 83.66 =&gt; ERROR\ntesting 60000000 -&gt; 60123852.00 hz \/ divider: 2.08 duty cycle: 99.98 =&gt; ERROR\ntesting 100000000 -&gt; 100206424.00 hz \/ divider: 1.25 duty cycle: 99.98 =&gt; ERROR\n<\/code><\/pre>\n<p>The effective frequencies are much closer to the requested measuring frequencies &#8211; which is a good thing! We can also achieve quite some high frequencies &#8211; but the measuring results seem to be getting very wrong at very high speeds.<\/p>\n<p>I think that the test PWM signal has just a frequency which is too low: So if we measure at full speed we are not able to capture and store a full cycle because we run out of memory too quick.<\/p>\n<p>So to test this properly I will need to adjust the frequency of the test signal dependent on the measuring frequency. Unfortunately there is standard Arduino API for this&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a first DRAFT version for the Pico PIO implementation of the PicoCapturePIO capturing class for my Arduino Logic Analyzer Library ready and started to run some tests. The Test Sketch is part of the project and can be found in the examples forlder. I was using a PWM [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[20,25,10],"tags":[],"class_list":["post-2914","post","type-post","status-publish","format-standard","hentry","category-arduino","category-logicanalyzer","category-projects"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The Rasperry Pico PIO for my Logical Analzyer: Some Tests - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Rasperry Pico PIO for my Logical Analzyer: Some Tests - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"I have a first DRAFT version for the Pico PIO implementation of the PicoCapturePIO capturing class for my Arduino Logic Analyzer Library ready and started to run some tests. The Test Sketch is part of the project and can be found in the examples forlder. I was using a PWM [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-24T12:11:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-25T15:08:03+00:00\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/24\\\/using-the-rasperry-pico-pio-as-logical-analzyer\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/24\\\/using-the-rasperry-pico-pio-as-logical-analzyer\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"The Rasperry Pico PIO for my Logical Analzyer: Some Tests\",\"datePublished\":\"2021-04-24T12:11:23+00:00\",\"dateModified\":\"2021-04-25T15:08:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/24\\\/using-the-rasperry-pico-pio-as-logical-analzyer\\\/\"},\"wordCount\":259,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"articleSection\":[\"Arduino\",\"LogicAnalyzer\",\"Projects\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/24\\\/using-the-rasperry-pico-pio-as-logical-analzyer\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/24\\\/using-the-rasperry-pico-pio-as-logical-analzyer\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/24\\\/using-the-rasperry-pico-pio-as-logical-analzyer\\\/\",\"name\":\"The Rasperry Pico PIO for my Logical Analzyer: Some Tests - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"datePublished\":\"2021-04-24T12:11:23+00:00\",\"dateModified\":\"2021-04-25T15:08:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/24\\\/using-the-rasperry-pico-pio-as-logical-analzyer\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/24\\\/using-the-rasperry-pico-pio-as-logical-analzyer\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2021\\\/04\\\/24\\\/using-the-rasperry-pico-pio-as-logical-analzyer\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Rasperry Pico PIO for my Logical Analzyer: Some Tests\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Rasperry Pico PIO for my Logical Analzyer: Some Tests - Phil Schatzmann","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/","og_locale":"en_US","og_type":"article","og_title":"The Rasperry Pico PIO for my Logical Analzyer: Some Tests - Phil Schatzmann","og_description":"I have a first DRAFT version for the Pico PIO implementation of the PicoCapturePIO capturing class for my Arduino Logic Analyzer Library ready and started to run some tests. The Test Sketch is part of the project and can be found in the examples forlder. I was using a PWM [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/","og_site_name":"Phil Schatzmann","article_published_time":"2021-04-24T12:11:23+00:00","article_modified_time":"2021-04-25T15:08:03+00:00","author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"The Rasperry Pico PIO for my Logical Analzyer: Some Tests","datePublished":"2021-04-24T12:11:23+00:00","dateModified":"2021-04-25T15:08:03+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/"},"wordCount":259,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"articleSection":["Arduino","LogicAnalyzer","Projects"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/","url":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/","name":"The Rasperry Pico PIO for my Logical Analzyer: Some Tests - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"datePublished":"2021-04-24T12:11:23+00:00","dateModified":"2021-04-25T15:08:03+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2021\/04\/24\/using-the-rasperry-pico-pio-as-logical-analzyer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"The Rasperry Pico PIO for my Logical Analzyer: Some Tests"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/2914","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=2914"}],"version-history":[{"count":19,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/2914\/revisions"}],"predecessor-version":[{"id":2963,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/2914\/revisions\/2963"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=2914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=2914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=2914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}