<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Learning to Pi</title>
	<atom:link href="https://www.learningtopi.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.learningtopi.com/</link>
	<description>Programming Python on SBC&#039;s and Microcontrollers</description>
	<lastBuildDate>Fri, 20 Oct 2023 15:32:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://www.learningtopi.com/wp-content/uploads/2022/04/cropped-circuit-150x150.png</url>
	<title>Learning to Pi</title>
	<link>https://www.learningtopi.com/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>RPI5 or Rock 5B?</title>
		<link>https://www.learningtopi.com/sbc/raspberry-pi/rpi5-or-rock-5b/</link>
					<comments>https://www.learningtopi.com/sbc/raspberry-pi/rpi5-or-rock-5b/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Thu, 19 Oct 2023 23:09:39 +0000</pubDate>
				<category><![CDATA[Raspberry Pi SBC]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[Pi4B]]></category>
		<category><![CDATA[Rock5B]]></category>
		<category><![CDATA[RPI5]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=1241</guid>

					<description><![CDATA[<p>It is official! The Raspberry Pi 5 is being released October 2023! (Official product page) I expect it will be some time before I can get my hands on one. Until then I will need to compare specifications. Lets take a look at the RPI5 and the Rock 5B. NOTE: This article will compare the...</p>
<p>The post <a href="https://www.learningtopi.com/sbc/raspberry-pi/rpi5-or-rock-5b/">RPI5 or Rock 5B?</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<p>It is official!  The Raspberry Pi 5 is being released October 2023!  (<a href="https://www.raspberrypi.com/products/raspberry-pi-5/" target="_blank" rel="noreferrer noopener">Official product page</a>)  I expect it will be some time before I can get my hands on one.  Until then I will need to compare specifications.  Lets take a look at the RPI5 and the Rock 5B.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>NOTE:  This article will compare the specification of the Pi 5 as is currently available.  Some details may change.  There has also been some elusion to new features that will be enabled down the road.</p>
</blockquote>



<p>Over the past few years as Raspberry Pi stock has been hard to get a hold of I&#8217;ve started testing SBC&#8217;s from other vendors (Radxa, OrangePi, Banana Pi, Atomic Pi, Mango Pi, etc).  I&#8217;ve currently settled on a Rock 5B with the Rockchip RK3588 as my primary board.</p>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1000" height="1000" src="https://www.learningtopi.com/wp-content/uploads/rpi5.jpg" alt="" class="wp-image-1255" srcset="https://www.learningtopi.com/wp-content/uploads/rpi5.jpg 1000w, https://www.learningtopi.com/wp-content/uploads/rpi5-300x300.jpg 300w, https://www.learningtopi.com/wp-content/uploads/rpi5-150x150.jpg 150w, https://www.learningtopi.com/wp-content/uploads/rpi5-768x768.jpg 768w, https://www.learningtopi.com/wp-content/uploads/rpi5-850x850.jpg 850w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>
</div>
</div>



<h2 class="wp-block-heading">The Specs</h2>



<p>I included the Pi 4B in addition to the Pi 5 and Radxa Rock 5B for comparison.  I don&#8217;t believe anyone would argue that the Pi 5 isn&#8217;t a very welcome upgrade to the Pi 4B, but how does it stack up to the top line RK3588 based SBC&#8217;s that you can get from Radxa, Orange Pi or others?</p>



<table id="tablepress-6" class="tablepress tablepress-id-6">
<thead>
<tr class="row-1">
	<td class="column-1" style="width:10%;"></td><th class="column-2" style="width:35%;">Raspberry Pi 4B</th><th class="column-3" style="width:20%;">Radxa Rock 5B</th><th class="column-4" style="width:35%;">Raspberry Pi 5</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">CPU</td><td class="column-2">Broadcom BCM2711<br />
4x ARM Cortex-A72 (600Mhz &#8211; 1.8GHz)</td><td class="column-3">Rockchip RK3588<br />
4x ARM Cortex-A76 (408Mhz &#8211; 2.4Ghz)<br />
4x ARM Cortex-A55 (408Mhz &#8211; 1.8Ghz)</td><td class="column-4">Broadcom BCM2712<br />
4x ARM Cortex-A76 (??? &#8211; 2.4Ghz)</td>
</tr>
<tr class="row-3">
	<td class="column-1">NPU</td><td class="column-2">N/A</td><td class="column-3">6 TOPS  INT4/INT8/INT16/FP16<br />
TensorFlow/MXNet/PyTorch/Caffe can be easily converted<br />
300Mhz &#8211; 1Ghz (per /sys/class/devfreq/fdab0000.npu/available_frequencies</td><td class="column-4">N/A</td>
</tr>
<tr class="row-4">
	<td class="column-1">Memory</td><td class="column-2">1/2/4/8GB LPDDR4 3200Mhz 32-bit bus</td><td class="column-3">4/8/16GB LPDDR4 2112Mhz 64-bit bus</td><td class="column-4">4/8GB LPDDR4X 4267Mhz (at launch)</td>
</tr>
<tr class="row-5">
	<td class="column-1">GPU</td><td class="column-2">Broadcom VideoCore VI <br />
4 cores (200 &#8211; 500Mhz)</td><td class="column-3">ARM Mali-G610 MP4 3D GPU<br />
4 cores (300Mhz &#8211; 1Ghz)</td><td class="column-4">Broadcom VideoCore VII<br />
4 cores (?? &#8211; 800 Mhz)</td>
</tr>
<tr class="row-6">
	<td class="column-1">Video Decoding</td><td class="column-2">H.264, H.265 HEVC (8/10bit), VP8, VP9, VC-1, AVC, JPEG</td><td class="column-3">H.264, H.265 HEVC (8/10bit), VP8, VP9, VC-1, AVC, JPEG</td><td class="column-4">H.264, H.265</td>
</tr>
<tr class="row-7">
	<td class="column-1">Video Encoding</td><td class="column-2">H.264, JPEG</td><td class="column-3">H.264, H.265 HEVC (8/10bit), VP8, VP9, VC-1, AVC, JPEG</td><td class="column-4"></td>
</tr>
<tr class="row-8">
	<td class="column-1">GPU FP16/FP32/FP64</td><td class="column-2">64 / 32 / 8 GFLOPS</td><td class="column-3">? / 610 / ? GFLOPS</td><td class="column-4">? / 51.2 / ? GFLOPS</td>
</tr>
<tr class="row-9">
	<td class="column-1">Video Out</td><td class="column-2">2x micro HDMI + MIPI DSI</td><td class="column-3">2x HDMI + MIPI DSI</td><td class="column-4">2x micro HDMI + 2x MIPI 4-lane (can be used for cameras or displays)</td>
</tr>
<tr class="row-10">
	<td class="column-1">Video In</td><td class="column-2">MIPI CSI</td><td class="column-3">1x micro HDMI + MIPI CSI</td><td class="column-4">2x MIPI 4-lane (can be used for cameras or displays)</td>
</tr>
<tr class="row-11">
	<td class="column-1">Storage</td><td class="column-2">MicroSD<br />
USB 3.0 attached storage is supported</td><td class="column-3">PCIe 3.0 x4 M.2 M-key (up to 2280)<br />
MicroSD<br />
eMMC socket (<a href="https://wiki.radxa.com/Rock5/hardware/emmc" rel="noopener" target="_blank">ODroid compatible</a>)<br />
16MB SPI flash bootloader</td><td class="column-4">microSD (supports SDR104)</td>
</tr>
<tr class="row-12">
	<td class="column-1">USB</td><td class="column-2">2x USB 2.0 Type-A<br />
2x USB 3.0 Type-A</td><td class="column-3">2x USB 2.0 Type-A<br />
2x USB 3.0 Type-A</td><td class="column-4">2x USB 3.0 (supports concurrent 5Gbps)<br />
2x USB 2.0</td>
</tr>
<tr class="row-13">
	<td class="column-1">PCIe</td><td class="column-2">N/A<br />
</td><td class="column-3">PCIe 3.0 x4 M.2 M key (up to 2280 SSD for storage)<br />
PCIe 2.0 M.2 E key (for WiFi/Bluetooth module)<br />
</td><td class="column-4">PCIe 2.0 x1 (requires M.2 HAT or other adapter)</td>
</tr>
<tr class="row-14">
	<td class="column-1">Networking</td><td class="column-2">1Gbps Broadcom (BCM54213PE)<br />
802.11ac 2.4/5Ghz (Infineon CYW43455)</td><td class="column-3">2.5Gbps RTL8125 NIC<br />
No builtin wireless (<a href="https://wiki.radxa.com/Rock5/hardware/wifi" rel="noopener" target="_blank">requires PCIe M.2 E key module</a>)</td><td class="column-4">1Gbps Broadcom (BCM54213PE)<br />
802.11ac 2.4/5Ghz (Infineon CYW43455)</td>
</tr>
<tr class="row-15">
	<td class="column-1">Bluetooth</td><td class="column-2">Bluetooth 5.0, BLE (BCM54213PE)<br />
</td><td class="column-3">No builtin wireless (<a href="https://wiki.radxa.com/Rock5/hardware/wifi" rel="noopener" target="_blank">requires PCIe M.2 E key module</a>)</td><td class="column-4">Bluetooth 5.0, BLE (BCM54213PE)<br />
</td>
</tr>
<tr class="row-16">
	<td class="column-1">I2C</td><td class="column-2">up to 6x</td><td class="column-3">up to 5x</td><td class="column-4">TBD</td>
</tr>
<tr class="row-17">
	<td class="column-1">SPI</td><td class="column-2">up to 6x (however some SPI pins overlap with other SPI devices so all can&#8217;t be used at once)</td><td class="column-3">up to 3x</td><td class="column-4">TBD</td>
</tr>
<tr class="row-18">
	<td class="column-1">UART</td><td class="column-2">up to 6x UART</td><td class="column-3">up to 4x (<a href="https://wiki.radxa.com/Rock5/hardware/5b/gpio" rel="noopener" target="_blank">5x listed on GPIO pinout</a>, uart1 on pinout doesn&#8217;t have an overlay file.  There are 2 additional overlay files that don&#8217;t match to pins on the GPIO header &#8211; uart 6 and 8)</td><td class="column-4">TBD</td>
</tr>
<tr class="row-19">
	<td class="column-1">PWM</td><td class="column-2">up to 4x (2 PWM controllers with 2 outputs each)</td><td class="column-3">up to 10x (<a href="https://wiki.radxa.com/Rock5/hardware/5b/gpio" rel="noopener" target="_blank">10x listed on GPIO pinout</a>, 4 additional overlay files that don&#8217;t match to pins on the GPIO header)</td><td class="column-4">TBD</td>
</tr>
<tr class="row-20">
	<td class="column-1">ADC (analog to digital)</td><td class="column-2">N/A</td><td class="column-3">1x (could not find an overlay or any documentation for it yet)</td><td class="column-4">TBD</td>
</tr>
<tr class="row-21">
	<td class="column-1">CAN Bus</td><td class="column-2">N/A</td><td class="column-3">1x (listed on GPIO pinout but no builtin overlay and driver isn&#8217;t compiled in the default kernel)</td><td class="column-4">TBD</td>
</tr>
<tr class="row-22">
	<td class="column-1">General GPIO / Other</td><td class="column-2">up to 28x</td><td class="column-3">up to 26x</td><td class="column-4">up to 28x<br />
Builtin RTC w/ external battery</td>
</tr>
<tr class="row-23">
	<td class="column-1">Power</td><td class="column-2">5v DC with USB-C plug 3A<br />
5v DC on pins 2&amp;4 3A</td><td class="column-3">USB PD 2.0 12/15/20v with 2amp or higher<br />
9-20v DC power with USB-C plug<br />
5v PoE power on pins 2&amp;4</td><td class="column-4">USB-C 5v 5A<br />
Includes a power button</td>
</tr>
<tr class="row-24">
	<td class="column-1">Kernel Support</td><td class="column-2">6.1 (<a href="https://github.com/raspberrypi/linux" rel="noopener" target="_blank">RPI fork</a>, updates are pushed back to mainline)</td><td class="column-3">5.10 (<a href="https://github.com/radxa/kernel" rel="noopener" target="_blank">Radxa fork</a>, <a href="https://gitlab.collabora.com/hardware-enablement/rockchip-3588/notes-for-rockchip-3588/-/blob/main/mainline-status.md" rel="noopener" target="_blank">RK3588 mainline integration status</a>)</td><td class="column-4"></td>
</tr>
<tr class="row-25">
	<td class="column-1">Purchase Links</td><td class="column-2"><a href="https://amzn.to/3PlH0w9" target="_blank" rel="noopener">Amazon (1/2/4GB models)</a><br />
<a href="https://amzn.to/43IQJB4" target="_blank" rel="noopener">Amazon (8GB model)<a/></td><td class="column-3"><a href="https://amzn.to/46a49Yy" target="_blank" rel="noopener">Amazon (8GB model)</a><br />
<a href="https://www.okdo.com/us/p/okdo-rock-5-model-b-8gb-single-board-computer-rockchip-rk3588-arm-cortex-a76-cortex-a55/?utm_source=google&amp;utm_medium=surfaces&amp;utm_campaign=usafeed_shopping&amp;utm_content=surfaces_across_google&amp;gad=1&amp;gclid=CjwKCAjw-b-kBhB-EiwA4fvKrAGH2b9-MV_nTBrrw1tVYKqw1g_XKtoWi8_b5k_L1U5l5jaBvwhmLhoCSM0QAvD_BwE&amp;gclsrc=aw.ds" target="_blank" rel="noopener">OKDO (8GB model)</a></td><td class="column-4"></td>
</tr>
</tbody>
</table>
<!-- #tablepress-6 from cache -->


<h2 class="wp-block-heading">CPU &#8211; Advantage Rock 5B</h2>



<p>The 4x A76 cores of the Pi 5 are a big update from the 4x A72&#8217;s in the 4B.  Personally I never felt that the Pi 4B was powerful enough for a GUI if you intend to use it as a regular desktop.  The Rock 5B on the other hand has become my defacto standard desktop.</p>



<p>It is a bit disapointing to see that the RPI5 went with 4x A76 cores without the added 4x A55 cores of the RK3588.  This seems even more odd when you look at the release dates of the different ARM cores:</p>



<ul class="wp-block-list">
<li>A72 &#8211; 2016 (RPI4)</li>



<li>A76 &#8211; 2018 (RPI5 / RK3588)</li>



<li>A78 &#8211; 2020</li>



<li>A710 &#8211; 2021</li>



<li>A715 &#8211; 2022</li>



<li>A720 &#8211; 2023</li>
</ul>



<p>It does take some time from an ARM release before new cores start showing up in devices, but I&#8217;m surprised that the RPI5 didn&#8217;t take advantage of the A78 to leapfrog the competition.  Based on benchmarks of others with pre-release RPI5&#8217;s (<a href="https://www.youtube.com/watch?v=nBtOEmUqASQ" target="_blank" rel="noreferrer noopener">https://www.youtube.com/watch?v=nBtOEmUqASQ</a>) the RPI5 is coming out already at a performance disadvantage.</p>



<h2 class="wp-block-heading">RAM &#8211; Draw</h2>



<p>Both platforms are running LPDDR4.  The Rock 5B lists 2112Mhz vs RPI5&#8217;s 4267Mhz, but don&#8217;t be fooled by that.  From what I have seen, some platforms double the frequency if it is setup in dual channel.  The 2112Mhz reported by the Rock 5B comes directly from UBoot.  I have seen Radxa list it as 4224Mhz in some places.  </p>



<p>Both platforms offer 4 and 8GB platforms.  Rock 5B also offers a 16GB.  Based on the datasheet the RK3588 is capable of addressing up to 32GB.  I&#8217;m glad to see 4GB is the bottom end here.  Given the CPU capabilities running 1 or 2GB of RAM seems like a waste.  Personally I would run with 8GB unless there is a use case where you know 4GB will be sufficient.</p>



<h2 class="wp-block-heading">NPU &#8211; Advantage Rock 5B</h2>



<p>Personally I haven&#8217;t found an application to use the NPU available on the RK3588 yet, however it is surprising that in the day and age of everything AI that Raspberry Pi didn&#8217;t include one.  This may come down to a Broadcom issue, but it does add another reason customers may choose a different platform.  Given the number of years between Raspberry Pi releases, that means it could be 3+ years before we see a Raspberry Pi with an NPU.</p>



<h2 class="wp-block-heading">GPU &#8211; Draw?</h2>



<p>I generally don&#8217;t tax the GPU on my systems very heavily, and it is also difficult to compare GPU specs.  Both systems seem to have a 4 core GPU.  The Mali G610 MP4 on the RK3588 runs at 1Ghz and the Video Core VII on the RPI5 runs at 800Mhz.  The Mali G610 MP4 data I could find reported 610 GFLOPS at FP32 vs the 51.2 GFLOPS for the Video Core VII.  Does this mean that video is 10x better?  Probably not.  I&#8217;ll leave the video comparison to video experts.</p>



<h2 class="wp-block-heading">Storage &#8211; Advantage Rock 5B</h2>



<p>The Rock 5B comes with 3 storage options:</p>



<ul class="wp-block-list">
<li>Micro-SD with SDR104 support &#8211; Max at 104MBps</li>



<li>eMMC port &#8211; Max at 400MBps</li>



<li>M.2 PCIe 3.0 x4 supporting a standard 2280 SSD &#8211; Max at 4000MBps</li>
</ul>



<p>Moving away from the typical SD card MASSIVELY boosts performance.  The eMMC modules were quick, but nothing matches a PCIe SSD.  </p>



<p>The RPI5 also has 3 options:</p>



<ul class="wp-block-list">
<li>Mircro-SD with SDR104 support &#8211; Max at 104MBps</li>



<li>PCIe 2.0 x1 (requires a HAT with M.2 port as there is none onboard) &#8211; Max at 500MBps</li>



<li>USB 3.0 (each USB3 port runs as a separate USB 3.0 controller with a full 5Gbps throughput) &#8211; Max at ~500MBps</li>
</ul>



<p>The RPI5 increases the throughput on the MicroSD over the Pi4B, but doesn&#8217;t give anywhere near desktop level performance.  This may be adaquate for a headless IOT device, but for anything running a desktop application this level of performance is abysmal.</p>



<p>PCIe 2.0&#215;1 or USB3 could be used to increase storage throughput, but you are still maxed out at 500MBps.  For comparison I have a Crucial P3 500GB SSD in my Rock 5B rated for 3500MBps read and 3000MBps write (PCIe 3.0 x4).  I am surprised that Raspberry Pi didn&#8217;t provide any ability to handle the typical SSD&#8217;s that are available in desktops today.</p>



<p>I had to dig to find out that the Rock 5B / RK3588 does in fact support SDR104.  For confirmation I popped a SanDisk Extreme microSD card in:</p>



<pre class="wp-block-code"><code>&#91;4578960.554989] mmc_host mmc1: Bus speed (slot 0) = 198000000Hz (slot req 200000000Hz, actual 198000000HZ div = 0)
&#91;4578960.665326] dwmmc_rockchip fe2c0000.mmc: Successfully tuned phase to 360
&#91;4578960.665358] <strong>mmc1: new ultra high speed SDR104 SDXC card at address e624</strong>
&#91;4578960.666296] mmcblk1: mmc1:e624 SN64G 59.5 GiB </code></pre>



<p>The RPI5 still suffers from what I believe is the worst drawback to the PI4B, slow storage.</p>



<h2 class="wp-block-heading">USB &#8211; Draw</h2>



<p>The RPI5 documentation specifically calls out that the 2x USB 3.0 ports are controlled individually which means full 5Gbps on EACH port.  This is great when you compare to the Pi 4B which has a single USB3 controller that supports both ports.</p>



<p>After digging through Rockchip RK3588 datasheets and testing different USB 3 devices on my Rock 5B, I can confirm that the Rock 5B also has dual USB3 controllers.  It can be a bit tough to discern from the datasheet, but it appears that the RK3588 chip was designed to run displayport over those dual USB3 controllers (although I should note it does not appear that Radxa configured the Rock 5B to support displayport over USB3).</p>



<h2 class="wp-block-heading">GPIO / I2C / SPI / UART / etc &#8211; Draw</h2>



<p>I&#8217;m calling GPIO and other functions on the 40 pin header a draw.  There is some variance on how many I2C and SPI buses each can handle, but both are highly configurable and can support multiple of each.  The Rock 5B documentation does also call out an ADC sensor (which I have never found documentation or overlay files for) as well as a CAN bus (which I haven&#8217;t had a use for yet).</p>



<p>The only drawback I have for the Rock 5B is the issue I found will pull-up/pull-down (detailed <a href="https://www.learningtopi.com/templates/orangepi-5-testing-with-sbc_gpio/" target="_blank" rel="noreferrer noopener">here</a> for the Orange Pi 5, but applies to the Rock 5B as well).  I have been unable to get any information on why these don&#8217;t work or if they should.  For now I&#8217;ve stuck to external pull-up/down resistors.</p>



<h2 class="wp-block-heading">Power &#8211; Draw</h2>



<p>It appears that Raspberry Pi has in fact added support for USB-C PD!  That means the dreaded undervolt message may finally be a thing of the past!  There does seem to be a drawback though.  Using USB-C PD the PI5 does not have full power available for USB devices.  I don&#8217;t have information on exactly what the limit is, but apparently this is not a factor with the 5V 5A official power supply.</p>



<p>I wish more companies would adopt USB-C PD!  I&#8217;ve now acculumated quite a few power supplies that are looking for a new use!</p>



<h2 class="wp-block-heading">Kernel and Software &#8211; Advantage RPI5</h2>



<p>Software is where Raspberry Pi devices truely shine.  They have by far the most mature and well maintained software ecosystem.  Raspberry Pi 4&#8217;s are running kernel 6.1 while Rock 5B&#8217;s are stuck on 5.10.  I also see VERY few kernel updates from Radxa which means we aren&#8217;t getting security updates even though 5.10 is an LTS release.</p>



<p>Raspberry Pi also has by far the best confguraiton tool (raspi-config) that other platforms are typically lacking.  Radxa has no interface that can be used to select overlays or other board configuration options.  The only other company I&#8217;ve seen with a near-peer tool is Orange Pi (covered it in detail <a href="https://www.learningtopi.com/templates/orangepi-5-testing-with-sbc_gpio/" target="_blank" rel="noreferrer noopener">here</a>).</p>



<p>If you are new to SBC&#8217;s and GPIO&#8217;s, the Raspberry Pi is by FAR the easiest to learn on.  If you are familiar enough with applying overlays, the Rock 5B provides a high level of capability, you just have to know where to look.</p>



<h2 class="wp-block-heading">Networking &#8211; RPI5</h2>



<p>Over the past few years we&#8217;ve seen a slow shift to 2.5Gbps Ethernet as a pseudo standard.  More deivces are shipping with 2.5Gbps NIC&#8217;s, and retail switches are coming down in price to make it a reasonable option for home use.  We are also starting to see 1Gbps+ home internet, so the shift to faster Ethernet switches is now starting to be a necessity.</p>



<p>That being said, the Rock 5B ships with 2.5Gbps Ethernet, but the RPI5 does not (1Gbps only).  While I don&#8217;t count this as a big red mark against the Pi, it is an odd choice since it will likely be 3+ years before we get another Raspberry Pi.</p>



<p>While the Rock 5B does come with 2.5Gbps ethernet, it comes without WiFi or Bluetooth.  There is a PCIe 2.0 x1 E-Key M.2 port (separate from the PCIe 3.0 x4 M.2 used for storage) for a WiFi / Bluetooth card so it can be added.  This does just introduce additional cost if WiFi or Bluetooth is required,  The RPI5 comes equipped with 802.11ac 2.4/5Ghz WiFi and Bluetooth 5.0 with BLE built-in.</p>



<h2 class="wp-block-heading">Size &#8211; Depends on your need</h2>



<p>The RPI5 follows the typical (now defacto standard) Raspberry Pi size: 85x56mm (3.370×2.224in).  The Rock 5B actually follows the Pico-ITX form factor: 100x72mm (3.93&#215;2.83in).  This is a bit larger, but is still a compact system.  If size is the biggest concern there is either the Pi Zero 2 W or multiple other similar sized boards available.  There are also RK3588 boards that are smaller if size is truely a deciding factor.  Personally I&#8217;m ok with the larger size  coming with vastly increased storage speed, USB-C PD support, more and faster PCI-e, NPU, etc.</p>



<h2 class="wp-block-heading">Summary</h2>



<p>There are quite a few odd design choices with the RPI5 that I feel put it behind the curve:</p>



<ul class="wp-block-list">
<li>Quad core A76 &#8211; Missing the added 4x A55 cores of the RK3588, and not sure why newer A78 cores weren&#8217;t used.</li>



<li>1Gbps Ethernet &#8211; The standard today for new devices is moving to 2.5Gbps.</li>



<li>No NPU &#8211; Other high end boards (i.e. anything based on the RK3588) include NPU&#8217;s.  It would still be possible to add an external NPU via PCIe or USB3, it just consumes valuable ports.</li>



<li>Faster storage!  The SD104 update to the microSD is a nice addition, but the platform can&#8217;t compete with even years old desktop storage.</li>
</ul>



<p>It seems like Raspberry Pi has become the slow moving Titantic and other vendors are pushing the boundaries further.  I will certainly get a RPI5 as soon as I can find one. (I still haven&#8217;t found a Zero 2 W for less than an exorbitant price.) It is very unlikely that I&#8217;ll replace my Rock 5B as a desktop anytime soon.</p>



<h2 class="wp-block-heading">Final Notes</h2>



<p>If you are new to SBC&#8217;s the RPI5 (or even a PI4B if you can find them) is the best place to start.  If you are looking for something with higher capacity to act as a file server, media server, etc, I think the Rock 5B and other equivalent RK3588 based systems are still the best option.  Since the shortage of Pi&#8217;s during the pandemic, I&#8217;ve branched out and now don&#8217;t feel the Raspberry Pi is king of the hill any longer.  I&#8217;m looking forward to seeing what the next generation of boards will bring!</p>
<p>The post <a href="https://www.learningtopi.com/sbc/raspberry-pi/rpi5-or-rock-5b/">RPI5 or Rock 5B?</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/raspberry-pi/rpi5-or-rock-5b/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OrangePi 5 &#8211; Testing with sbc_gpio</title>
		<link>https://www.learningtopi.com/templates/orangepi-5-testing-with-sbc_gpio/</link>
					<comments>https://www.learningtopi.com/templates/orangepi-5-testing-with-sbc_gpio/#comments</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Wed, 30 Aug 2023 05:30:35 +0000</pubDate>
				<category><![CDATA[OrangePi 5]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[OrangePi]]></category>
		<category><![CDATA[python sbc_gpio]]></category>
		<category><![CDATA[rk3588s]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=1216</guid>

					<description><![CDATA[<p>After a lot of success with the Radxa Rock 5B, I saw that Orange Pi was offering several different boards using the same Rockchip RK3588 or RK3588S chips. I decided to pick up the Orange Pi 5 that uses the RK3588S so I could check out the differences between the RK3588 and RK3588S. Also, since...</p>
<p>The post <a href="https://www.learningtopi.com/templates/orangepi-5-testing-with-sbc_gpio/">OrangePi 5 &#8211; Testing with sbc_gpio</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>After a lot of success with the Radxa Rock 5B, I saw that Orange Pi was offering several different boards using the same Rockchip RK3588 or RK3588S chips.  I decided to pick up the Orange Pi 5 that uses the RK3588S so I could check out the differences between the RK3588 and RK3588S.  Also, since both platforms are quite similar, I wanted to see how support and usability differed between the different vendors.  This is my first OrangePi board, so I was looking forward to it!</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<div class="wp-block-ht-block-toc  is-style-outline htoc htoc--position-wide toc-list-style-plain" data-htoc-state="expanded"><span class="htoc__title"><span class="ht_toc_title">Table of Contents</span><span class="htoc__toggle"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#444"><path d="M15 7H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1z"></path><path d="M15 1H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1zM15 13H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1z"></path></g></svg></span></span><div class="htoc__itemswrap"><ul class="ht_toc_list"><li class=""><a href="#htoc-scoring-and-specs">Orange Pi 5 Specs</a></li><li class=""><a href="#htoc-sbc-scoring-results">SBC Scoring Results</a></li><li class=""><a href="#htoc-gpio-s-1-1">GPIO&#8217;s (0/1)</a></li><li class=""><a href="#htoc-ir-1-1">IR (1/1)</a></li><li class=""><a href="#htoc-i2c-0-1">I2C (1/1)</a></li><li class=""><a href="#htoc-spi-1-2">SPI (1/2)</a></li><li class=""><a href="#htoc-uart-0-1">UART (1/1)</a></li><li class=""><a href="#htoc-subjective-performance-1-2">Subjective Performance (2/2)</a></li><li class=""><a href="#htoc-ease-of-use-0-2">Ease of Use (1/2)</a></li><li class=""><a href="#htoc-software-updates-1-2">Software Updates (1/2)</a><ul class="ht_toc_child_list"><li class=""><a href="#htoc-kernel">Kernel</a></li><li class=""><a href="#htoc-system">System</a></li></ul></li><li class=""><a href="#htoc-community-0-2">Community (1/2)</a></li><li class=""><a href="#htoc-issues">Issues</a></li><li class=""><a href="#htoc-overall-5-14">Overall (9/14)</a></li></ul></div></div>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-gallery has-nested-images columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img decoding="async" width="661" height="468" data-id="1232" src="https://www.learningtopi.com/wp-content/uploads/orangepi5-board.png" alt="http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-5.html" class="wp-image-1232" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi5-board.png 661w, https://www.learningtopi.com/wp-content/uploads/orangepi5-board-300x212.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi5-board-150x106.png 150w" sizes="(max-width: 661px) 100vw, 661px" /></figure>



<figure class="wp-block-image size-large"><img decoding="async" width="593" height="592" data-id="1233" src="https://www.learningtopi.com/wp-content/uploads/orangepi5-board2.png" alt="http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-5.html" class="wp-image-1233" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi5-board2.png 593w, https://www.learningtopi.com/wp-content/uploads/orangepi5-board2-300x299.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi5-board2-150x150.png 150w" sizes="(max-width: 593px) 100vw, 593px" /></figure>
</figure>
</div>
</div>



<h2 class="wp-block-heading" id="htoc-scoring-and-specs">Orange Pi 5 Specs</h2>



<p>The specs for the OrangePi 5 are similar to the Radxa Rock 5B, but there are a few variances.  The OrangePi 5 is a smaller board that uses the RK3588S chip (as opposed to the RK3588).  The RK3588S is essentially a cut down version of the RK3588.  The PCIe 3.0 has been removed which means that an NVMe SSD will need to use the PCIe 2.0 that the Rock 5B has for the wireless module.  This also means that if you want to use an NVMe SSD, you&#8217;ll need to use USB for your WiFi.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p id="htoc-n1">NOTE:  My testing was all performed using the Orange Pi 5.  There are two similar boards available that have some slightly different options:</p>



<ul class="wp-block-list">
<li>OrangePi 5B &#8211; Removes the PCIe port and replaces it with built-in WiFi and Bluetooth.  Same RK3588S with a 26 pin header (rather than the standard 40)/</li>



<li>OrangePi 5 Plus &#8211; This is more similar to the Radxa Rock 5B.  Uses the RK3588, has dual PCIe (1x M-Key and 1x E-key), dual HDMI out, eMMC interface, 40pin GPIO</li>
</ul>



<p id="htoc-i">I intentionally chose to skip the OrangePi 5 Plus since it is nearly identical to the Raxda Rock 5B.  The OrangePi 5 has less GPIO ports and less PCIe, but it is also smaller and costs less.  Based on what I&#8217;ve seen I would expect the OrangePi 5 Plus to perform nearly identical to the Radxa Rock 5B.</p>
</blockquote>



<table id="tablepress-6-no-2" class="tablepress tablepress-id-6">
<thead>
<tr class="row-1">
	<td class="column-1" style="width:20%;"></td><th class="column-2" style="width:80%;">OrangePi 5 (and 5B)</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">CPU</td><td class="column-2">Rockchip RK3588S<br />
4x ARM Cortex-A76 (408Mhz &#8211; 2.4Ghz)<br />
4x ARM Cortex-A55 (408Mhz &#8211; 1.8Ghz)</td>
</tr>
<tr class="row-3">
	<td class="column-1">NPU</td><td class="column-2">6 TOPS  INT4/INT8/INT16/FP16<br />
TensorFlow/MXNet/PyTorch/Caffe can be easily converted<br />
300Mhz &#8211; 1Ghz (per /sys/class/devfreq/fdab0000.npu/available_frequencies</td>
</tr>
<tr class="row-4">
	<td class="column-1">Memory</td><td class="column-2">4/8/16/32GB LPDDR4</td>
</tr>
<tr class="row-5">
	<td class="column-1">GPU</td><td class="column-2">ARM Mali-G610 MP4 3D GPU<br />
4 cores (300Mhz &#8211; 1Ghz)</td>
</tr>
<tr class="row-6">
	<td class="column-1">Video Decoding</td><td class="column-2">H.264, H.265 HEVC (8/10bit), VP8, VP9, VC-1, AVC, JPEG</td>
</tr>
<tr class="row-7">
	<td class="column-1">Video Encoding</td><td class="column-2">H.264, H.265 HEVC (8/10bit), VP8, VP9, VC-1, AVC, JPEG</td>
</tr>
<tr class="row-8">
	<td class="column-1">GPU FP16/FP32/FP64</td><td class="column-2">? / 610 / ? GFLOPS</td>
</tr>
<tr class="row-9">
	<td class="column-1">Video Out</td><td class="column-2">1x HDMI + 1x DisplayPort 1.4 (via USB-C) + 2x MIPI D-PHY TX 4 Lane</td>
</tr>
<tr class="row-10">
	<td class="column-1">Video In</td><td class="column-2">MIPI CSI 4Lane + 2x MIPI D-PHY RX 4 Lane</td>
</tr>
<tr class="row-11">
	<td class="column-1">Storage</td><td class="column-2">MicroSD<br />
16MB QSPI bootflash<br />
M.2 M-Key (supports 2242 only)<br />
** 5B includes 32/64/128GB eMMC</td>
</tr>
<tr class="row-12">
	<td class="column-1">USB</td><td class="column-2">1x USB 3.0 Type-A<br />
2x UsB 2.0 Type-A<br />
1x USB 3.1 Type-C</td>
</tr>
<tr class="row-13">
	<td class="column-1">PCIe</td><td class="column-2">PCIe 2.0 M.2 M key (up to 2242 SSD only!)<br />
** 5B has NO PCIe slot (builtin WiFi/BT instead)</td>
</tr>
<tr class="row-14">
	<td class="column-1">Networking</td><td class="column-2">YT8531C Gigabit Ethernet<br />
** 5B includes Dual-band WiFi6</td>
</tr>
<tr class="row-15">
	<td class="column-1">Bluetooth</td><td class="column-2">None<br />
** 5B includes 5.0 with BLE support</td>
</tr>
<tr class="row-16">
	<td class="column-1">I2C</td><td class="column-2">up to 3x</td>
</tr>
<tr class="row-17">
	<td class="column-1">SPI</td><td class="column-2">up to 1x</td>
</tr>
<tr class="row-18">
	<td class="column-1">UART</td><td class="column-2">up to 4x</td>
</tr>
<tr class="row-19">
	<td class="column-1">PWM</td><td class="column-2">up to 5x</td>
</tr>
<tr class="row-20">
	<td class="column-1">ADC (analog to digital)</td><td class="column-2">N/A</td>
</tr>
<tr class="row-21">
	<td class="column-1">CAN Bus</td><td class="column-2">up to 2x</td>
</tr>
<tr class="row-22">
	<td class="column-1">General GPIO / Other</td><td class="column-2">up to 17x</td>
</tr>
<tr class="row-23">
	<td class="column-1">Power</td><td class="column-2">USB-C 5v 4A</td>
</tr>
<tr class="row-24">
	<td class="column-1">Kernel Support</td><td class="column-2">5.10 (<a href="https://github.com/orangepi-xunlong/linux-orangepi/tree/orange-pi-5.10-rk3588" target="_blank" rel="noopener">Orange Pi fork</a>)</td>
</tr>
<tr class="row-25">
	<td class="column-1">Purchase Links</td><td class="column-2"><a href="https://www.amazon.com/Orange-Pi-Frequency-Development-Android12/dp/B0BN17BRYY/ref=sr_1_3?crid=HJQ357XB16FK&amp;keywords=orange%2Bpi%2B5&amp;qid=1693201723&amp;sprefix=ornge%2Bpi%2B%2Caps%2C159&amp;sr=8-3&amp;ufe=app_do%3Aamzn1.fos.f5122f16-c3e8-4386-bf32-63e904010ad0&amp;th=1" target="_blank" rel="noopener">OrangePi 5 8GB (Amazon)</a><br />
<a href="https://www.aliexpress.us/item/3256804755535571.html?spm=a2g0o.productlist.main.5.3ad9fc0bkGy88I&amp;algo_pvid=90279085-5d57-4d34-b821-269c7405083a&amp;algo_exp_id=90279085-5d57-4d34-b821-269c7405083a-2&amp;pdp_npi=4%40dis%21USD%2185.00%2185.0%21%21%2185.00%21%21%402101d64d16932019284023832eb1f8%2112000034095080979%21sea%21US%210%21A&amp;curPageLogUid=7gFDcqWb1nTz" target="_blank" rel="noopener">OrangePi 5 8GB (AliExpress)</a><br />
<a href="https://www.amazon.com/Orange-Pi-Rockchip-Frequency-Development/dp/B0BZ48S5Y8/ref=sr_1_8?crid=V4JOLUV00GP7&amp;keywords=orange%2Bpi%2B5b&amp;qid=1693201825&amp;sprefix=ornge%2Bpi%2B5b%2Caps%2C157&amp;sr=8-8&amp;ufe=app_do%3Aamzn1.fos.f5122f16-c3e8-4386-bf32-63e904010ad0&amp;th=1" target="_blank" rel="noopener">OrangePi 5B 8GB WiFi (Amazon)</a><br />
<a href="https://www.aliexpress.us/item/3256805169475894.html?spm=a2g0o.productlist.main.13.5d864a95iiMDbv&amp;algo_pvid=d48b083f-f862-472d-955b-723f48b77413&amp;algo_exp_id=d48b083f-f862-472d-955b-723f48b77413-6&amp;pdp_npi=4%40dis%21USD%21105.00%21105.0%21%21%21105.00%21%21%402103231116932019782871599e62b1%2112000032727653072%21sea%21US%210%21A&amp;curPageLogUid=SO1jLhbN4Qli" target="_blank" rel="noopener">OrangePi 5B 8GB WiFi (AliExpress)</a></td>
</tr>
</tbody>
</table>



<h2 class="wp-block-heading" id="htoc-sbc-scoring-results">SBC Scoring Results</h2>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<table id="tablepress-10" class="tablepress tablepress-id-10">
<thead>
<tr class="row-1">
	<th class="column-1" style="width:50%;">Category</th><th class="column-2" style="width:50%;">OrangePi 5</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">Tests &#8211; GPIO&#8217;s (1pt)</td><td class="column-2">0/1</td>
</tr>
<tr class="row-3">
	<td class="column-1">Tests &#8211; IR (1pt)</td><td class="column-2">1/1</td>
</tr>
<tr class="row-4">
	<td class="column-1">Tests &#8211; I2C (1pt)</td><td class="column-2">1/1</td>
</tr>
<tr class="row-5">
	<td class="column-1">Tests &#8211; SPI (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-6">
	<td class="column-1">Tests &#8211; UART (1pt)</td><td class="column-2">1/1</td>
</tr>
<tr class="row-7">
	<td class="column-1">Subjective Performance (2pt)</td><td class="column-2">2/2</td>
</tr>
<tr class="row-8">
	<td class="column-1">Ease of Use (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-9">
	<td class="column-1">Software Updates (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-10">
	<td class="column-1">Community (2pt)</td><td class="column-2">1/2</td>
</tr>
</tbody>
<tfoot>
<tr class="row-11">
	<th class="column-1">Overall (14pt)</th><th class="column-2">9/14</th>
</tr>
</tfoot>
</table>
<!-- #tablepress-10 from cache --></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<p>Scoring the SBC for comparison purposes. Scoring will be based on the following criteria:<br><strong>&#8211; GPIO (1pt) &#8211;</strong> LED and button tests passed and there are at least 8 usable GPIO&#8217;s<br><strong>&#8211; I2C (1pt) &#8211;</strong> I2C display tests passed<br><strong>&#8211; SPI (1pt) &#8211;</strong> SPI tests passed (BME280 and DHT11 over SPI)<br><strong>&#8211; UART (1pt) &#8211;</strong> UART tests passed and multiple UARTs are available<br><strong>&#8211; Subjective Performance (1pt) &#8211;</strong> Was the system responsive and functional overall<br><strong>&#8211; Ease of Use (1pt) &#8211;</strong> How easy was it to setup and use for the sbc_gpio tests? Can it be reconfigured quickly?<br><strong>&#8211; Software Updates (2pt) &#8211;</strong> How frequently does the system get updates? 1pt for base system, 1pt for kernel<br><strong>&#8211; Community (2pt) &#8211;</strong> Finding answers to questions, getting recommendations and help is an important part of using a SBC</p>
</div>
</div>



<h2 class="wp-block-heading" id="htoc-gpio-s-1-1">GPIO&#8217;s (0/1)</h2>



<p>Before you cry foul, I didn&#8217;t knock off points for the fewer number of GPIO&#8217;s (uses a 26 pin header instead of a 40 pin).  I bought this board knowing that there were fewer GPIO pins.  I knocked off the GPIO point because I was unable to get internal pull-up or pull-down resistors to work AT ALL.  Using libgpiod tools, I tested setting the pull-up and pull-down on multiple different pins and was unable to see any change.</p>



<p>The lack of pull-up and pull-down made me go back and re-test this on multiple other systems including:</p>



<ul class="wp-block-list">
<li>Radxa Rock 5B (RK3588) &#8211; ALSO wouldn&#8217;t apply internal pull-up or pull-down</li>



<li>Raspberry Pi 4B (Broadcom BCM2711) &#8211; Works perfectly!</li>



<li>Visionfive Starfive 2 (RISC-V JH7110) &#8211; Works perfectly! (Happened to be sitting on my desk, stay tuned for an article for this device)</li>



<li>BIGTREETECH CB1 (Allwinner H616) &#8211; Works perfectly (within the confines of the pull-up/down resistors being a different value on some pins, see my <a href="https://www.learningtopi.com/sbc/cb1/bigtreetech-cb1/" target="_blank" rel="noreferrer noopener">CB1 article </a>for more)</li>
</ul>



<p>I did find reference to the pull-up/down in the Rockchip datasheets for the <a href="https://learningtopi.github.io/datasheets/Rockchip%20RK3588.pdf" target="_blank" rel="noreferrer noopener">RK3588</a>/<a href="https://learningtopi.github.io/datasheets/Rockchip%20RK3588S.pdf" target="_blank" rel="noreferrer noopener">RK3588S </a>but can&#8217;t seem to get it to work on either the OrangePi 5 or Radxa Rock 5B.  For now, external pull-up/down resistors are required.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p id="htoc-n">NOTE:  I did post a question in the Radxa (for the Rock 5B) forum but haven&#8217;t had a single response as of yet.</p>
</blockquote>



<h2 class="wp-block-heading" id="htoc-ir-1-1">IR (1/1)</h2>



<p>Just like the Rock 5B, the OrangePi 5 handled all the IR tests with no problem at all.  The only downside is that you need to create the overlays yourself since OrangePi doesn&#8217;t include them in the built-in overlays.  However, all the necessary drivers are already compiled into the kernel, and the <code>orangepi-config</code> tool had a section to install LIRC daemon and tools:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="540" height="374" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-lirc.png" alt="" class="wp-image-1217" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-lirc.png 540w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-lirc-300x208.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-lirc-150x104.png 150w" sizes="auto, (max-width: 540px) 100vw, 540px" /></figure>



<p>I&#8217;ll get into the <code>orangepi-config</code> tool more in the Ease of Use section.  A copy of the overlay files can be found on our <a href="https://learningtopi.github.io/orangepi5" target="_blank" rel="noreferrer noopener">GitHub files share</a>.  OrangePi uses UBOOT startup with <code>boot.scr </code>that already incorporates a mechanism to add your own custom overlays.  Simply copy the compiled overlay files (dbto) to the <code>/boot/overlay-user </code>directory, then add the following line to the<code> /boot/orangepiEnv.txt</code> file:</p>



<pre class="wp-block-code"><code>user_overlays=gpio-ir-recv-1d2 gpio-ir-tx-1d3</code></pre>



<p>After a reboot, both LIRC devices are initialized and ready to go!  Not quite as easy as a Raspberry Pi, but pretty close.</p>



<h2 class="wp-block-heading" id="htoc-i2c-0-1">I2C (1/1)</h2>



<p>Not a lot to say here.  Unlike the BIGTREETECH CB1 which used a software I2C driver, there are 3x I2C devices exposed from the RK3588S SOC.  I was impressed that they managed to configure 3x as optional on the 26 pin header.  The orangepi-config tool has the option to enable the I2C:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="308" height="651" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c.png" alt="" class="wp-image-1218" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c.png 308w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c-142x300.png 142w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c-71x150.png 71w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c-300x634.png 300w" sizes="auto, (max-width: 308px) 100vw, 308px" /></figure>



<p>Alternatively, you can add <code>i2c5-m3</code> to the <code>overlays </code>line in the<code> /boot/orangepiEnv.txt</code> file.</p>



<p>Everything with the I2C display worked perfectly.</p>



<h2 class="wp-block-heading" id="htoc-spi-1-2">SPI (1/2)</h2>



<p>For the SPI test, I used both a BME280 and DHT22 connected to SPI.  (I created a Python library for <a href="https://www.learningtopi.com/sbc/python_dht11_spi/">reading DHT from the SPI</a> bus since bit-banging has become too unreliable).  Both worked, but I couldn&#8217;t run them both at the same time since OrangePi only exposed one SPI bus on the 26 pin header.  We can&#8217;t connect the DHT22 to the same SPI bus as another device due to pull-up issues on the MISO port.  I docked a point due to the fact that only one SPI bus was available.  (I am working on a way to make the DHT SPI Python setup work alongside other SPI devices, more to come.)</p>



<p>Enabling the SPI bus is again a breeze using the <code>orangepi-config</code> tool.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="308" height="651" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi.png" alt="" class="wp-image-1219" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi.png 308w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi-142x300.png 142w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi-71x150.png 71w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi-300x634.png 300w" sizes="auto, (max-width: 308px) 100vw, 308px" /></figure>



<p>Alternatively, you can add <code>spi4-m0-cs1-spidev</code> to the <code>overlays </code>line in the<code> /boot/orangepiEnv.txt</code> file.</p>



<p>The only confusing part is making sure you select the right one.  Only <code>spi4-m0 </code>is exposed on the 26 pin header.  It would be nice if OrangePi would just list the available overlays.</p>



<h2 class="wp-block-heading" id="htoc-uart-0-1">UART (1/1)</h2>



<p>The UART tests passed without a hitch on the OrangePi 5 just like with the Radxa Rock 5B.  I had essentially 100% success except for 1 test out of 15,000 always seems to fail.  The Raspberry Pi 4B and 3B always seemed to end up in the 90-93% success rate that struck me as a buffering issue.  The OrangePi 5 and Rock 5B based on the Rockchip 3588(S) worked flawlessly.</p>



<p>The only minor irritation here is that separate from the 26 pin header is a 3 pin serial header that is used for debugging.  I have not yet found a way to re-purpose this UART port for use in the OS.  If this could be converted to a standard UART interface that would free up additional ports on the limited 26 pin header.</p>



<p>Enabling the UART is again a breeze using the <code>orangepi-config</code> tool.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="308" height="645" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart.png" alt="" class="wp-image-1220" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart.png 308w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart-143x300.png 143w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart-72x150.png 72w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart-300x628.png 300w" sizes="auto, (max-width: 308px) 100vw, 308px" /></figure>



<p>Alternatively, you can add <code>uart0-m2</code> to the <code>overlays </code>line in the<code> /boot/orangepiEnv.txt</code> file.</p>



<h2 class="wp-block-heading" id="htoc-subjective-performance-1-2">Subjective Performance (2/2)</h2>



<p>The RK3588S in the OrangePi 5 is essentially the same as the RK3588 in the Rock 5B when it comes to CPU.  Both have 4x A76 (up to 2.4Ghz) and 4x A55 (up to 1.8Ghz).  My main bottleneck was the SD card I was booting from.  I have an NVMe SSD to install, I just haven&#8217;t set it up yet.  As far as I&#8217;m concerned, the RK3588(S) is good enough to use as a normal desktop.</p>



<p>OrangePi also has ZRAM pre-configured in their image (virtual swap space using compressed RAM, see my <a href="https://www.learningtopi.com/uncategorized/zram-for-your-sbc/" target="_blank" rel="noreferrer noopener">article on ZRAM</a> for more info).  I&#8217;ve found that swap setup isn&#8217;t configured by all vendors, so I was pleased to see this.  I also saw that ZRAM was used to create a compressed mount point for <code>/var/log</code>.  This is something I haven&#8217;t seen on other images from board vendors.  Moving logging into RAM loses persistence, but for devices running on SD cards it will boost performance by eliminating a lot of background writes, and extend the life of your SD card.</p>



<h2 class="wp-block-heading" id="htoc-ease-of-use-0-2">Ease of Use (1/2)</h2>



<p>I really want to give OrangePi props for their <code>orangepi-config</code> tool.  This is the ONLY vendor I&#8217;ve found so far with a tool that can come close to matching the <code>raspi-config </code>tool.  The <code>orangepi-config </code>tool even has several features that <code>raspi-config </code>doesn&#8217;t have.</p>



<p>I showed some parts of the orangepi-config tool above while configuring the I2C, SPI and UART overlays.</p>



<figure class="wp-block-gallery has-nested-images columns-3 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="653" height="276" data-id="1227" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-main.png" alt="" class="wp-image-1227" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-main.png 653w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-main-300x127.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-main-150x63.png 150w" sizes="auto, (max-width: 653px) 100vw, 653px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="585" height="218" data-id="1230" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-system.png" alt="" class="wp-image-1230" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-system.png 585w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-system-300x112.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-system-150x56.png 150w" sizes="auto, (max-width: 585px) 100vw, 585px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="522" height="218" data-id="1222" src="https://www.learningtopi.com/wp-content/uploads/orangep-config-bootloader.png" alt="" class="wp-image-1222" srcset="https://www.learningtopi.com/wp-content/uploads/orangep-config-bootloader.png 522w, https://www.learningtopi.com/wp-content/uploads/orangep-config-bootloader-300x125.png 300w, https://www.learningtopi.com/wp-content/uploads/orangep-config-bootloader-150x63.png 150w" sizes="auto, (max-width: 522px) 100vw, 522px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="653" height="429" data-id="1226" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-boot-config.png" alt="" class="wp-image-1226" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-boot-config.png 653w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-boot-config-300x197.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-boot-config-150x99.png 150w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-boot-config-350x230.png 350w" sizes="auto, (max-width: 653px) 100vw, 653px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="604" height="291" data-id="1225" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-network.png" alt="" class="wp-image-1225" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-network.png 604w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-network-300x145.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-network-150x72.png 150w" sizes="auto, (max-width: 604px) 100vw, 604px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="751" height="204" data-id="1228" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-ssh.png" alt="" class="wp-image-1228" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-ssh.png 751w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-ssh-300x81.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-ssh-150x41.png 150w" sizes="auto, (max-width: 751px) 100vw, 751px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="308" height="645" data-id="1220" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart.png" alt="" class="wp-image-1220" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart.png 308w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart-143x300.png 143w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart-72x150.png 72w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-uart-300x628.png 300w" sizes="auto, (max-width: 308px) 100vw, 308px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="308" height="651" data-id="1219" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi.png" alt="" class="wp-image-1219" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi.png 308w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi-142x300.png 142w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi-71x150.png 71w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-spi-300x634.png 300w" sizes="auto, (max-width: 308px) 100vw, 308px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="308" height="651" data-id="1218" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c.png" alt="" class="wp-image-1218" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c.png 308w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c-142x300.png 142w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c-71x150.png 71w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-i2c-300x634.png 300w" sizes="auto, (max-width: 308px) 100vw, 308px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="540" height="374" data-id="1217" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-lirc.png" alt="" class="wp-image-1217" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-lirc.png 540w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-lirc-300x208.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-lirc-150x104.png 150w" sizes="auto, (max-width: 540px) 100vw, 540px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="606" height="189" data-id="1229" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-personal.png" alt="" class="wp-image-1229" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-personal.png 606w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-personal-300x94.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-personal-150x47.png 150w" sizes="auto, (max-width: 606px) 100vw, 606px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="603" height="167" data-id="1223" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-3rdparty.png" alt="" class="wp-image-1223" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-3rdparty.png 603w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-3rdparty-300x83.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-3rdparty-150x42.png 150w" sizes="auto, (max-width: 603px) 100vw, 603px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="487" height="269" data-id="1224" src="https://www.learningtopi.com/wp-content/uploads/orangepi-config-help.png" alt="" class="wp-image-1224" srcset="https://www.learningtopi.com/wp-content/uploads/orangepi-config-help.png 487w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-help-300x166.png 300w, https://www.learningtopi.com/wp-content/uploads/orangepi-config-help-150x83.png 150w" sizes="auto, (max-width: 487px) 100vw, 487px" /></figure>
</figure>



<p>As you can see, we have a range of options available:</p>



<ul class="wp-block-list">
<li>Programming the bootloader to different devices</li>



<li>Editing the <code>orangepiEnv.txt</code> file</li>



<li>Selecting overlays</li>



<li>Configuring network settings</li>



<li>Installing / uninstalling LIRC</li>



<li>Time zone</li>



<li>SSH options (including OTP)</li>



<li>Even some 3rd Party software</li>
</ul>



<p>I really would give this a 2/2 if not for a few oddities:</p>



<ul class="wp-block-list">
<li>Overlay page lists overlays that are not applicable (i.e. SPI overlays that use pins not exposed on the OrangePi 5, although they may work on the OrangePi 5 Pro)</li>



<li>Change some setting aren&#8217;t reflected until you close the app and re-open it (i.e. the time zone)</li>



<li>It isn&#8217;t always clear what selecting something will do.  For example, selecting &#8220;Avahi&#8221; from the system settings menu will kick off downloading and installing packages, as well as configuring them without any clear message as to what was about to happen.</li>



<li>Crashed several times</li>
</ul>



<p>The orangepi-config tool is excellent but has some rough edges.  I would certainly start here to configure your SBC.</p>



<h2 class="wp-block-heading" id="htoc-software-updates-1-2">Software Updates (1/2)</h2>



<h3 class="wp-block-heading" id="htoc-kernel">Kernel</h3>



<p>Just like with every SBC I&#8217;ve worked with that ISN&#8217;T a Raspberry Pi, the kernel doesn&#8217;t seem to be getting any updates.  The OrangePi 5 uses the same 5.10.110 kernel that is used by the Radxa Rock 5B (not entirely surprising since they are almost the same chip).  They both appear to use the same Rockchip kernel as their base, and I don&#8217;t see any security updates being applied.</p>



<p>It seems safe to assume that Rockchip selected 5.10 since it is an LTS release that is slated for support through December 2026.  However, they forked at 5.10.110 and the kernel has continued on to 5.10.192 (as of August 2023).  This seems to defeat the purpose of using an LTS kernel if you aren&#8217;t ever going to update it.</p>



<h3 class="wp-block-heading" id="htoc-system">System</h3>



<p>Here is where things get a bit strange.  The image I downloaded was the official OrangePi 5 Ubuntu 22.04 (jammy) release.  For some reason rather than using Ubuntu mirrors, the system is configured to use Huawei servers for Ubuntu and <code>aliyun.com</code> for Docker.  Here are the apt sources (from <code>/etc/apt/sources.list</code> and <code>/etc/apt/sources.list.d/docker.list</code>):</p>



<pre class="wp-block-code"><code>deb http://repo.huaweicloud.com/ubuntu-ports/ jammy main restricted universe multiverse
deb http://repo.huaweicloud.com/ubuntu-ports/ jammy-security main restricted universe multiverse
deb http://repo.huaweicloud.com/ubuntu-ports/ jammy-updates main restricted universe multiverse
deb http://repo.huaweicloud.com/ubuntu-ports/ jammy-backports main restricted universe multiverse
deb &#91;arch=arm64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu jammy stable
</code></pre>



<p>The aliyun.com mirror for docker seems to be a Docker supported mirror (based on its presence in the <a href="https://get.docker.com/">Docker install script</a>).  The Huawei mirror also seems legit based on <a href="https://launchpad.net/ubuntu/+mirror/repo.huaweicloud.com-archive">https://launchpad.net/ubuntu/+mirror/repo.huaweicloud.com-archive</a>.  I get that OrangePi is a Chinese company, and these mirrors may make the most sense for them, but it would be nice to see an image for those of us not in China.  Using a wired connection on my Gigabit internet, I was seeing up to 200ms latency to the Huawei mirrors (NOTE: repo.huaweicloud.com resolved to a CDN, so milage here may vary).</p>



<p>Unusual APT sources aside, they do appear to mirror the official Ubuntu release, so we are getting updates.  It was also nice to see a 22.04 image rather than the 20.04 that some other vendors provide.</p>



<h2 class="wp-block-heading" id="htoc-community-0-2">Community (1/2)</h2>



<p>There is an OrangePi forum (<a href="http://www.orangepi.org/orangepibbsen/">http://www.orangepi.org/orangepibbsen/</a>), however it seems relatively small.  The forum also covers a wide range of SBC boards that OrangePi offers which can be good and bad.  On the plus side, the OrangePi 5 is not their first board, so the setup seems well thought out.  The downside is it has been difficult to find much for this specific board.  Searching the forum for &#8220;OrangePi 5&#8221; only found 31 matches and quite a few of those weren&#8217;t for the OrangePi 5.</p>



<p>This also brings me to another issue, the name.  OrangePi is the company, the model is &#8220;5&#8221;.  There is also a &#8220;5B&#8221; (which is basically the same board with WiFi and BT in place of the PCIe slot) and a &#8220;5 Pro&#8221; which is a different chip (RK3588 instead of the RK3588S).  The &#8220;5 Pro&#8221; has quite a few different features including two PCIe slots and a 40 pin GPIO header.  Searching for the OrangePi 5 has actually been a bit of a struggle.  I keep getting results for the &#8220;5 Pro&#8221; that don&#8217;t apply, or just end up with OrangePi articles that have the number &#8220;5&#8221; somewhere in them.  More characters in the name would make searching a bit easier.  Even making it a &#8220;5A&#8221; and &#8220;5B&#8221; would help.</p>



<h2 class="wp-block-heading" id="htoc-issues">Issues</h2>



<p>In the <a href="#htoc-gpio-s-1-1">GPIO </a>section I covered the issue with the internal pull-up and pull-down.  I was not able to get either to work on any of the pins I tested using multiple version of libgpiod.  This isn&#8217;t a total show-stopper, it just means that external pull-up or pull-down resistors are required until I can figure out if they are just not supported on the RK3588/RK3588S or if it is a bug that needs fixing.</p>



<p>The other issues are pretty minor.  I only have 1 <a href="#htoc-spi-1-2">SPI </a>bus available which meant I couldn&#8217;t test the BME280 and DHT22 at the same time (this is a limitation of how I am reading the DHT22 sensor and not a limitation of the SPI bus itself).  I was also a bit surprised by the APT repos, but that should be configurable.</p>



<h2 class="wp-block-heading" id="htoc-overall-5-14">Overall (9/14)</h2>



<p>All in all, this is a very solid system.  The <code>orangepi-config</code> utility gives a level of usability that my Radxa Rock 5B was missing.  You can tell that OrangePi has been building SBC&#8217;s for some time now based of the effort put into the software.</p>



<p>The only real caution here is the limited number of GPIO&#8217;s and the issue with internal pull-up/pull-down resistors.  If you think you&#8217;ll need 2x SPI or just more GPIO&#8217;s in general then I would suggest looking at the OrangePi 5 Pro instead (where the full 40 pin header is available).  This board only scored lower than the Radxa Rock 5B due to the single SPI bus.</p>



<p>One last note on a performance perspective.  the RK3588S appears to drop the PCIe 3.0 x4 bus that is present on the RK3588.  That means that the NVMe slot is connected to the PCIe 2.0 x1 bus.  The theoretical throughput limit is 500MB/sec which will still outperform eMMC or SD cards by a healthy margin.</p>



<p>I would highly recommend the OrangePi 5 (or one of the variants)!</p>
<p>The post <a href="https://www.learningtopi.com/templates/orangepi-5-testing-with-sbc_gpio/">OrangePi 5 &#8211; Testing with sbc_gpio</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/templates/orangepi-5-testing-with-sbc_gpio/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Bigtreetech CB1</title>
		<link>https://www.learningtopi.com/sbc/cb1/bigtreetech-cb1/</link>
					<comments>https://www.learningtopi.com/sbc/cb1/bigtreetech-cb1/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Fri, 28 Jul 2023 07:01:15 +0000</pubDate>
				<category><![CDATA[Bigtreetech CB1]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[CB1]]></category>
		<category><![CDATA[python sbc_gpio]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=1178</guid>

					<description><![CDATA[<p>I picked up the Bigtreetech CB1 (CM4 compatible) along with their Pi4B adapter (base for the CB1 or the Raspberry Pi Compute Module 4) for a stellar price. They are currently selling the CB1 module with the Pi4B for $36.98. Even though it only has 1GB of RAM, I figured it was worth a shot...</p>
<p>The post <a href="https://www.learningtopi.com/sbc/cb1/bigtreetech-cb1/">Bigtreetech CB1</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I picked up the <a href="https://biqu.equipment/products/pi4b-adapter-v1-0?variant=39919128969314">Bigtreetech CB1</a> (CM4 compatible) along with their Pi4B adapter (base for the CB1 or the Raspberry Pi Compute Module 4) for a stellar price.  They are currently selling the CB1 module with the Pi4B for $36.98.  Even though it only has 1GB of RAM, I figured it was worth a shot so I ordered it along with the $5.90 heatsink (which I discovered is a necessity).</p>



<p>I&#8217;ll walk through what I learned with this device and show some of the use cases it may come in handy, as well as where some of the shortfalls are.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<div class="wp-block-ht-block-toc  is-style-outline htoc htoc--position-wide toc-list-style-plain" data-htoc-state="expanded"><span class="htoc__title"><span class="ht_toc_title">Table of Contents</span></span><div class="htoc__itemswrap"><ul class="ht_toc_list"><li class=""><a href="#htoc-s">Scoring and Specs</a></li><li class=""><a href="#htoc-sbc-scoring-results">SBC Scoring Results</a></li><li class=""><a href="#htoc-gpio-s-1-1">GPIO&#8217;s (1/1)</a><ul class="ht_toc_child_list"><li class=""><a href="#htoc-the-pinout">The Pinout Confusion</a></li><li class=""><a href="#htoc-o">Official Pinout Table</a></li><li class=""><a href="#htoc-l">Logic Level &#8211; 1.8v or 3.3v?</a></li><li class=""><a href="#htoc-pull-up-pull-down-resistors">Pull-up / Pull-down Resistors</a></li></ul></li><li class=""><a href="#htoc-ir-1-1">IR (1/1)</a></li><li class=""><a href="#htoc-i2c-0-1">I2C (0/1)</a></li><li class=""><a href="#htoc-spi-1-2">SPI (1/2)</a></li><li class=""><a href="#htoc-uart-0-1">UART (0/1)</a></li><li class=""><a href="#htoc-subjective-performance-1-2">Subjective Performance (1/2)</a></li><li class=""><a href="#htoc-ease-of-use-0-2">Ease of Use (0/2)</a></li><li class=""><a href="#htoc-software-updates-1-2">Software Updates (1/2)</a></li><li class=""><a href="#htoc-community-0-2">Community (0/2)</a></li><li class=""><a href="#htoc-issues">Issues</a><ul class="ht_toc_child_list"><li class=""><a href="#htoc-security-groups-and-udev-not-setup-for-i2c-and-spi">Security Groups and UDEV not setup for I2C and SPI</a></li><li class=""><a href="#htoc-no-i2c-only-overlay">No I2C only overlay</a></li><li class=""><a href="#htoc-pins-that-don-t-work-pg6-pg7-pg8-pg9">Pins that don&#8217;t work (PG6, PG7, PG8, PG9)</a></li><li class=""><a href="#htoc-uart0-overlaps-with-twi-and-pwm">UART0 overlaps with TWI and PWM</a></li><li class=""><a href="#htoc-uart0-doesn-t-work-over-115200">UART0 doesn&#8217;t work over 115200</a></li><li class=""><a href="#htoc-pull-up-pull-down-resistor-inconsistancy">Pull-up / Pull-down Resistor Inconsistancy</a></li></ul></li><li class=""><a href="#htoc-overall-5-14">Overall (5/14)</a></li></ul></div></div>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-gallery has-nested-images columns-1 is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-full is-style-default"><img loading="lazy" decoding="async" width="412" height="302" data-id="1180" src="https://www.learningtopi.com/wp-content/uploads/cb1-e1690006962553.webp" alt="" class="wp-image-1180" srcset="https://www.learningtopi.com/wp-content/uploads/cb1-e1690006962553.webp 412w, https://www.learningtopi.com/wp-content/uploads/cb1-e1690006962553-300x220.webp 300w, https://www.learningtopi.com/wp-content/uploads/cb1-e1690006962553-150x110.webp 150w" sizes="auto, (max-width: 412px) 100vw, 412px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="484" height="349" data-id="1181" src="https://www.learningtopi.com/wp-content/uploads/Pi4B-carrier-e1690006984986.webp" alt="" class="wp-image-1181" srcset="https://www.learningtopi.com/wp-content/uploads/Pi4B-carrier-e1690006984986.webp 484w, https://www.learningtopi.com/wp-content/uploads/Pi4B-carrier-e1690006984986-300x216.webp 300w, https://www.learningtopi.com/wp-content/uploads/Pi4B-carrier-e1690006984986-150x108.webp 150w" sizes="auto, (max-width: 484px) 100vw, 484px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="464" height="336" data-id="1182" src="https://www.learningtopi.com/wp-content/uploads/cb1-heatsink-e1690007003898.webp" alt="" class="wp-image-1182" srcset="https://www.learningtopi.com/wp-content/uploads/cb1-heatsink-e1690007003898.webp 464w, https://www.learningtopi.com/wp-content/uploads/cb1-heatsink-e1690007003898-300x217.webp 300w, https://www.learningtopi.com/wp-content/uploads/cb1-heatsink-e1690007003898-150x109.webp 150w" sizes="auto, (max-width: 464px) 100vw, 464px" /></figure>
</figure>
</div>
</div>



<h2 class="wp-block-heading" id="htoc-s">Scoring and Specs</h2>



<p>Here is a breakdown of the scoring.  I&#8217;ll cover each section below to describe how I came to the numbers.</p>



<p>The specifications for the CB1 that I was able to collect are available below:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p id="htoc-n">NOTE: The Pi4B carrier board has capabilities that the CB1 doesn&#8217;t (i.e. a Gigabit NIC).  The specifications are specific to the CB1 itself.</p>
</blockquote>



<table id="tablepress-6-no-3" class="tablepress tablepress-id-6">
<thead>
<tr class="row-1">
	<td class="column-1" style="width:20%;"></td><th class="column-2" style="width:80%;">BIGTREETECH CB1 w/ Pi4B Adapter v1.0</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">CPU</td><td class="column-2">Allwinner H616<br />
4x ARM Cortex-A53 (? &#8211; 1.5Ghz)</td>
</tr>
<tr class="row-3">
	<td class="column-1">NPU</td><td class="column-2">N/A</td>
</tr>
<tr class="row-4">
	<td class="column-1">Memory</td><td class="column-2">512MB / 1GB (1GB only with eMMC)</td>
</tr>
<tr class="row-5">
	<td class="column-1">GPU</td><td class="column-2">ARM Mali G31 MP2<br />
2 cores (650Mhz)</td>
</tr>
<tr class="row-6">
	<td class="column-1">Video Decoding</td><td class="column-2">H.265, H.264</td>
</tr>
<tr class="row-7">
	<td class="column-1">Video Encoding</td><td class="column-2">H.264</td>
</tr>
<tr class="row-8">
	<td class="column-1">GPU FP16/FP32/FP64</td><td class="column-2">? / 20.8 / ? GFLOPS</td>
</tr>
<tr class="row-9">
	<td class="column-1">Video Out</td><td class="column-2">(Pi4B Carrier Board) 2x micro-HDMI</td>
</tr>
<tr class="row-10">
	<td class="column-1">Video In</td><td class="column-2">n/a (MIPI CSI on Pi4B bpard, but not functional with CB1)</td>
</tr>
<tr class="row-11">
	<td class="column-1">Storage</td><td class="column-2">eMMC 16 / 32 GB<br />
(Pi4B Carrier Board) MicroSD</td>
</tr>
<tr class="row-12">
	<td class="column-1">USB</td><td class="column-2">(Pi4B Carrier Board) 4x USB 2.0 Type-A</td>
</tr>
<tr class="row-13">
	<td class="column-1">PCIe</td><td class="column-2">N/A</td>
</tr>
<tr class="row-14">
	<td class="column-1">Networking</td><td class="column-2">100Mbps Ethernet (Pi4B Carrier Board is 1Gbps capable, but CB1 is not)<br />
Realtek 8189 802.11n 2.4Ghz WiFi</td>
</tr>
<tr class="row-15">
	<td class="column-1">Bluetooth</td><td class="column-2">N/A</td>
</tr>
<tr class="row-16">
	<td class="column-1">I2C</td><td class="column-2">None, software driver provided</td>
</tr>
<tr class="row-17">
	<td class="column-1">SPI</td><td class="column-2">up to 1x</td>
</tr>
<tr class="row-18">
	<td class="column-1">UART</td><td class="column-2">up to 1x (overlaps with PWM)</td>
</tr>
<tr class="row-19">
	<td class="column-1">PWM</td><td class="column-2">up to 1x (overlaps with UART)</td>
</tr>
<tr class="row-20">
	<td class="column-1">ADC (analog to digital)</td><td class="column-2">N/A</td>
</tr>
<tr class="row-21">
	<td class="column-1">CAN Bus</td><td class="column-2">up to 1x (not tested)</td>
</tr>
<tr class="row-22">
	<td class="column-1">General GPIO / Other</td><td class="column-2">up to 16x (docs say 20x.  Couldn&#8217;t get PG6,PG7,PG8,PG9 to work)</td>
</tr>
<tr class="row-23">
	<td class="column-1">Power</td><td class="column-2">(Pi4B Carrier Board) 5v DC with USB-C plug 2A</td>
</tr>
<tr class="row-24">
	<td class="column-1">Kernel Support</td><td class="column-2">5.16 (<a href="https://github.com/bigtreetech/CB1-Kernel" target="_blank" rel="noopener">Kernel Repo</a>)</td>
</tr>
<tr class="row-25">
	<td class="column-1">Purchase Links</td><td class="column-2"><a href="https://biqu.equipment/products/pi4b-adapter-v1-0"><a href="https://biqu.equipment/products/pi4b-adapter-v1-0" target="_blank" rel="noopener">Biqu</a><br />
<a href="https://www.amazon.com/BIGTREETECH-Adapter-Support-Octopus-Raspberry-Pi/dp/B0BLN8VCVN/ref=sr_1_7_sspa?keywords=cb1+bigtreetech&amp;qid=1689918970&amp;refinements=p_n_deal_type%3A23566065011&amp;sprefix=CB1+big%2Caps%2C123&amp;sr=8-7-spons&amp;ufe=app_do%3Aamzn1.fos.006c50ae-5d4c-4777-9bc0-4513d670b6bc&amp;sp_csd=d2lkZ2V0TmFtZT1zcF9tdGY&amp;psc=1" target="_blank" rel="noopener">Amazon</a></a></td>
</tr>
</tbody>
</table>



<h2 class="wp-block-heading" id="htoc-sbc-scoring-results">SBC Scoring Results</h2>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<table id="tablepress-10-no-2" class="tablepress tablepress-id-10">
<thead>
<tr class="row-1">
	<th class="column-1" style="width:50%;">Category</th><th class="column-2" style="width:50%;">BIGTREETECH CB1 w/ Pi4B Adapter v1.0</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">Tests &#8211; GPIO&#8217;s (1pt)</td><td class="column-2">1/1</td>
</tr>
<tr class="row-3">
	<td class="column-1">Tests &#8211; IR (1pt)</td><td class="column-2">1/1</td>
</tr>
<tr class="row-4">
	<td class="column-1">Tests &#8211; I2C (1pt)</td><td class="column-2">0/1</td>
</tr>
<tr class="row-5">
	<td class="column-1">Tests &#8211; SPI (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-6">
	<td class="column-1">Tests &#8211; UART (1pt)</td><td class="column-2">0/1</td>
</tr>
<tr class="row-7">
	<td class="column-1">Subjective Performance (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-8">
	<td class="column-1">Ease of Use (2pt)</td><td class="column-2">0/2</td>
</tr>
<tr class="row-9">
	<td class="column-1">Software Updates (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-10">
	<td class="column-1">Community (2pt)</td><td class="column-2">0/2</td>
</tr>
</tbody>
<tfoot>
<tr class="row-11">
	<th class="column-1">Overall (14pt)</th><th class="column-2">5/14</th>
</tr>
</tfoot>
</table>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<p>Scoring the SBC for comparison purposes. Scoring will be based on the following criteria:<br><strong>&#8211; GPIO (1pt) &#8211;</strong> LED and button tests passed and there are at least 8 usable GPIO&#8217;s<br><strong>&#8211; I2C (1pt) &#8211;</strong> I2C display tests passed<br><strong>&#8211; SPI (1pt) &#8211;</strong> SPI tests passed (BME280 and DHT11 over SPI)<br><strong>&#8211; UART (1pt) &#8211;</strong> UART tests passed and multiple UARTs are available<br><strong>&#8211; Subjective Performance (1pt) &#8211;</strong> Was the system responsive and functional overall<br><strong>&#8211; Ease of Use (1pt) &#8211;</strong> How easy was it to setup and use for the sbc_gpio tests? Can it be reconfigured quickly?<br><strong>&#8211; Software Updates (2pt) &#8211;</strong> How frequently does the system get updates? 1pt for base system, 1pt for kernel<br><strong>&#8211; Community (2pt) &#8211;</strong> Finding answers to questions, getting recommendations and help is an important part of using a SBC</p>
</div>
</div>



<h2 class="wp-block-heading" id="htoc-gpio-s-1-1">GPIO&#8217;s (1/1)</h2>



<p>I gave a point for GPIO&#8217;s because the CB1 has more than 8.  However there are 8 pins on the 40 pin header that are not connected (per their documentation).  I found an additional 4 that were present in the documentation but flat out wouldn&#8217;t work (PG6, PG7, PG8 and PG9).</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p id="htoc-note-the-allwinner-h616-has-tons-of-available-gpio-s-spi-i2c-uart-etc-etc-for-whatever-reason-they-just-aren-t-connected-to-pins-that-you-can-use-this-will-become-a-common-theme">NOTE:  The Allwinner H616 has TONS of available GPIO&#8217;s, SPI, I2C, UART, etc, etc.  For whatever reason they just aren&#8217;t connected to pins that you can use.  This will become a common theme.</p>
</blockquote>



<h3 class="wp-block-heading" id="htoc-the-pinout">The Pinout Confusion</h3>



<p>I copied the HTML directly from the CB1 <a href="https://github.com/bigtreetech/CB1/blob/master/readme.md" target="_blank" rel="noreferrer noopener">readme file</a>.  Understanding the table took a bit.  There are apparently two different versions of the CB1.  Mine has no eMMC.  I couldn&#8217;t find the eMMC version anywhere.  You can also see that the pin layout is different between the two CB1&#8217;s (with and without eMMC).  They throw in the Pi CM4 for reference as well as some other board (BTT Pi) which just adds to the confusion.</p>



<h3 class="wp-block-heading" id="htoc-o">Official Pinout Table</h3>



<table style="color:black">
<tr>
    <td rowspan=2 align=center bgcolor=gray>
        Pin
    </td>
    <td colspan=2 align=center bgcolor=#B7DEE8>
        BTT Pi
    </td>
    <td colspan=2 align=center bgcolor=#E6B8B7>
        CB1 eMMC
    </td>
    <td colspan=2 align=center bgcolor=#CCC0DA>
        CB1
    </td>
    <td colspan=2 align=center bgcolor=#D8E4BC>
        CM4
    </td>
    <td colspan=2 align=center bgcolor=#D8E4BC>
        CM4
    </td>
    <td colspan=2 align=center bgcolor=#CCC0DA>
        CB1
    </td>
    <td colspan=2 align=center bgcolor=#E6B8B7>
        CB1 eMMC
    </td>
    <td colspan=2 align=center bgcolor=#B7DEE8>
        BTT Pi
    </td>
    <td rowspan=2 align=center bgcolor=gray>
        Pin
    </td>
</tr>

<tr>
    <td bgcolor=#B7DEE8>
        Signal
    </td>
    <td align=center bgcolor=#B7DEE8>
        Description
    </td>
    <td align=center bgcolor=#E6B8B7>
        Signal
    </td>
    <td align=center bgcolor=#E6B8B7>
        Description
    </td>
    <td align=center bgcolor=#CCC0DA>
        Signal
    </td>
    <td align=center bgcolor=#CCC0DA>
        Description
    </td>
    <td align=center bgcolor=#D8E4BC>
        Signal
    </td>
    <td align=center bgcolor=#D8E4BC>
        Description
    </td>
    <td align=center bgcolor=#D8E4BC>
        Signal
    </td>
    <td align=center bgcolor=#D8E4BC>
        Description
    </td>
    <td align=center bgcolor=#CCC0DA>
        Signal
    </td>
    <td align=center bgcolor=#CCC0DA>
        Description
    </td>
    <td align=center bgcolor=#E6B8B7>
        Signal
    </td>
    <td align=center bgcolor=#E6B8B7>
        Description
    </td>
    <td align=center bgcolor=#B7DEE8>
        Signal
    </td>
    <td align=center bgcolor=#B7DEE8>
        Description
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        1
    </td>
    <td colspan=2 align=center bgcolor=yellow>
        3.3V
    </td>
    <td colspan=2 align=center bgcolor=yellow>
        3.3V
    </td>
    <td colspan=2 align=center bgcolor=yellow>
        3.3V
    </td>
    <td colspan=2 align=center bgcolor=yellow>
        3.3V
    </td>
    <td colspan=2 align=center bgcolor=red>
        5V
    </td>
    <td colspan=2 align=center bgcolor=red>
        5V
    </td>
    <td colspan=2 align=center bgcolor=red>
        5V
    </td>
    <td colspan=2 align=center bgcolor=red>
        5V
    </td>
    <td bgcolor=gray>
        2
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        3
    </td>
    <td bgcolor=#B7DEE8>
        PC3
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO67
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO2
    </td>
    <td align=center bgcolor=#D8E4BC>
        I2C1 SDA
    </td>
    <td colspan=2 align=center bgcolor=red>
        5V
    </td>
    <td colspan=2 align=center bgcolor=red>
        5V
    </td>
    <td colspan=2 align=center bgcolor=red>
        5V
    </td>
    <td colspan=2 align=center bgcolor=red>
        5V
    </td>
    <td bgcolor=gray>
        4
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        5
    </td>
    <td bgcolor=#B7DEE8>
        PC0
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO64
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO3
    </td>
    <td align=center bgcolor=#D8E4BC>
        I2C1 SCL
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td bgcolor=gray>
        6
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        7
    </td>
    <td bgcolor=#B7DEE8>
        PC7
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO71
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI14
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO170
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC7
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO71
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO4
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPCLK0
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO14
    </td>
    <td align=center bgcolor=#D8E4BC>
        UART TX
    </td>
    <td align=center bgcolor=#CCC0DA>
        PH0
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO224, UART0_TX
    </td>
    <td align=center bgcolor=#E6B8B7>
        PH0
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO224, UART0_TX
    </td>
    <td align=center bgcolor=#B7DEE8>
        PH0
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO224, UART0_TX
    </td>
    <td bgcolor=gray>
        8
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        9
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO15
    </td>
    <td align=center bgcolor=#D8E4BC>
        UART RX
    </td>
    <td align=center bgcolor=#CCC0DA>
        PH1
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO225, UART0_RX
    </td>
    <td align=center bgcolor=#E6B8B7>
        PH1
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO225, UART0_RX
    </td>
    <td align=center bgcolor=#B7DEE8>
        PH1
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO225, UART0_RX
    </td>
    <td bgcolor=gray>
        10
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        11
    </td>
    <td bgcolor=#B7DEE8>
        PC14
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO78
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI15
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO271
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC14
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO78
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO17
    </td>
    <td align=center bgcolor=#D8E4BC>
        SPI1 CE1
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO18
    </td>
    <td align=center bgcolor=#D8E4BC>
        PCM CLK
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC13
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO77
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI7
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO263
    </td>
    <td align=center bgcolor=#B7DEE8>
        PC13
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO77
    </td>
    <td bgcolor=gray>
        12
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        13
    </td>
    <td bgcolor=#B7DEE8>
        PC12
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO76
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI6
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO262
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC12
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO76
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO27
    </td>
    <td align=center bgcolor=#D8E4BC>
        <br />
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td bgcolor=gray>
        14
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        15
    </td>
    <td bgcolor=#B7DEE8>
        PC10
    </td>
    <td align=center bgcolor=#B7DEE8>
        74
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI4
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO260
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC10
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO74
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO22
    </td>
    <td align=center bgcolor=#D8E4BC>
        <br />
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO23
    </td>
    <td align=center bgcolor=#D8E4BC>
        <br />
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC11
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO75
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI5
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO261
    </td>
    <td align=center bgcolor=#B7DEE8>
        PC11
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO75
    </td>
    <td bgcolor=gray>
        16
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        17
    </td>
    <td colspan=2 align=center bgcolor=yellow>
        3.3V
    </td>
    <td colspan=2 align=center bgcolor=yellow>
        3.3V
    </td>
    <td colspan=2 align=center bgcolor=yellow>
        3.3V
    </td>
    <td colspan=2 align=center bgcolor=yellow>
        3.3V
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO24
    </td>
    <td align=center bgcolor=#D8E4BC>
        <br />
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC9
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO73
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI3
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO259
    </td>
    <td align=center bgcolor=#B7DEE8>
        PC9
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO73
    </td>
    <td bgcolor=gray>
        18
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        19
    </td>
    <td bgcolor=#B7DEE8>
        PH7
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO231, SPI1_MOSI
    </td>
    <td align=center bgcolor=#E6B8B7>
        PH7
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO231, SPI1_MOSI
    </td>
    <td align=center bgcolor=#CCC0DA>
        PH7
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO231, SPI1_MOSI
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO10
    </td>
    <td align=center bgcolor=#D8E4BC>
        SPI0 MOSI
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td bgcolor=gray>
        20
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        21
    </td>
    <td bgcolor=#B7DEE8>
        PH8
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO232, SPI1_MISO
    </td>
    <td align=center bgcolor=#E6B8B7>
        PH8
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO232, SPI1_MISO
    </td>
    <td align=center bgcolor=#CCC0DA>
        PH8
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO232, SPI1_MISO
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO9
    </td>
    <td align=center bgcolor=#D8E4BC>
        SPI0 MISO
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO25
    </td>
    <td align=center bgcolor=#D8E4BC>
        <br />
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td align=center bgcolor=#B7DEE8>
        PG13
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO205
    </td>
    <td bgcolor=gray>
        22
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        23
    </td>
    <td bgcolor=#B7DEE8>
        PH6
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO230, SPI1_CLK
    </td>
    <td align=center bgcolor=#E6B8B7>
        PH6
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO230, SPI1_CLK
    </td>
    <td align=center bgcolor=#CCC0DA>
        PH6
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO230, SPI1_CLK
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO11
    </td>
    <td align=center bgcolor=#D8E4BC>
        SPI0 SCLK
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO8
    </td>
    <td align=center bgcolor=#D8E4BC>
        SPI0 CE0
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td align=center bgcolor=#B7DEE8>
        PG12
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO204
    </td>
    <td bgcolor=gray>
        24
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        25
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO7
    </td>
    <td align=center bgcolor=#D8E4BC>
        SPI0 CE1
    </td>
    <td align=center bgcolor=#CCC0DA>
        PG8
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO200
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI11
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO267
    </td>
    <td align=center bgcolor=#B7DEE8>
        PI9
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO265
    </td>
    <td bgcolor=gray>
        26
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        27
    </td>
    <td bgcolor=#B7DEE8>
        PC2
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO66
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO0
    </td>
    <td align=center bgcolor=#D8E4BC>
        EEPROM SDA
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO1
    </td>
    <td align=center bgcolor=#D8E4BC>
        EEPROM SCL
    </td>
    <td align=center bgcolor=#CCC0DA>
        PG7
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO199
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI10
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO266
    </td>
    <td align=center bgcolor=#B7DEE8>
        PI10
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO266
    </td>
    <td bgcolor=gray>
        28
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        29
    </td>
    <td bgcolor=#B7DEE8>
        PC4
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO68
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO5
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPCLK1
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td bgcolor=gray>
        30
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        31
    </td>
    <td bgcolor=#B7DEE8>
        PI5
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO261
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI9
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO265
    </td>
    <td align=center bgcolor=#CCC0DA>
        PG6
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO198
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO6
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPCLK2
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO12
    </td>
    <td align=center bgcolor=#D8E4BC>
        PWM0
    </td>
    <td align=center bgcolor=#CCC0DA>
        PG9
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO201
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI12
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO268
    </td>
    <td align=center bgcolor=#B7DEE8>
        PI6
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO262
    </td>
    <td bgcolor=gray>
        32
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        33
    </td>
    <td bgcolor=#B7DEE8>
        PI14
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO270
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO13
    </td>
    <td align=center bgcolor=#D8E4BC>
        PWM1
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td bgcolor=gray>
        34
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        35
    </td>
    <td bgcolor=#B7DEE8>
        PC6
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO70
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI1
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO257
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC6
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO70
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO19
    </td>
    <td align=center bgcolor=#D8E4BC>
        PCM FS
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO16
    </td>
    <td align=center bgcolor=#D8E4BC>
        SPI1 CE2
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td colspan=2 align=center bgcolor=gray>
        NC
    </td>
    <td align=center bgcolor=#B7DEE8>
        PG11
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO203
    </td>
    <td bgcolor=gray>
        36
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        37
    </td>
    <td bgcolor=#B7DEE8>
        PC15
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO79
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI13
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO269
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC15
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO79
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO26
    </td>
    <td align=center bgcolor=#D8E4BC>
        <br />
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO20
    </td>
    <td align=center bgcolor=#D8E4BC>
        PCM DIN
    </td>
    <td align=center bgcolor=#CCC0DA>
        PH10
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO234, IR_RX
    </td>
    <td align=center bgcolor=#E6B8B7>
        PH10
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO234, IR_RX
    </td>
    <td align=center bgcolor=#B7DEE8>
        PH4
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO228
    </td>
    <td bgcolor=gray>
        38
    </td>
</tr>

<tr>
    <td bgcolor=gray>
        39
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td colspan=2 align=center bgcolor=black>
        <font color=white>GND</font>
    </td>
    <td align=center bgcolor=#D8E4BC>
        GPIO21
    </td>
    <td align=center bgcolor=#D8E4BC>
        PCM DOUT
    </td>
    <td align=center bgcolor=#CCC0DA>
        PC8
    </td>
    <td align=center bgcolor=#CCC0DA>
        GPIO72
    </td>
    <td align=center bgcolor=#E6B8B7>
        PI2
    </td>
    <td align=center bgcolor=#E6B8B7>
        GPIO258
    </td>
    <td align=center bgcolor=#B7DEE8>
        PC8
    </td>
    <td align=center bgcolor=#B7DEE8>
        GPIO72
    </td>
    <td bgcolor=gray>
        40
    </td>
</tr>

</table>



<h3 class="wp-block-heading" id="htoc-l">Logic Level &#8211; 1.8v or 3.3v?</h3>



<p>You&#8217;ll also find if you read through the <a href="https://github.com/bigtreetech/CB1/blob/master/BIGTREETECH%20CB1%20User%20Manual.pdf" target="_blank" rel="noreferrer noopener">manual </a>(page 12) that if you have version 2.1 of the board PC6, PC7, PC8, PC9, PC10, PC11, PC12, PC13, PC14 and PC4 pins use logic voltage of 1.8v, but if you have version 2.2 it is 3.3v.  I&#8217;ve never before seen anything like this.  You&#8217;ll need to be sure of which version you have before laying out your project.</p>



<h3 class="wp-block-heading" id="htoc-pull-up-pull-down-resistors">Pull-up / Pull-down Resistors</h3>



<p>While testing my GPIO input that I&#8217;ve used on every other board I&#8217;ve tested I also discovered that the H616 SoC uses different pull-up/pull-down resistors for different blocks of pins.  Directly from the H616 datasheet:</p>



<ul class="wp-block-list">
<li>For PL0~PL1 ports the Rpu and Rpd are 4.7kΩ ±20%</li>



<li>For PC0, PC3 ~PC7, PF3 , PF6, a nd PG1~PG5 ports, the Rpu and Rpd are 15kΩ ±20%</li>



<li>For other GPIO ports, the Rpu and Rpd are 100kΩ ±20%</li>
</ul>



<p>For reference the Raspberry Pi uses pull-up / pull-down resistors that are 50-65kΩ.  I happened to pick port that had a 4.7kΩ pull-down which caused my button which was connected to 3.3v through a 1kΩ resistor not to work.  This is the first platform I&#8217;ve used that had different internal resistor values depending on the pin.  BEWARE!</p>



<h2 class="wp-block-heading" id="htoc-ir-1-1">IR (1/1)</h2>



<p>Here I was pleasantly suprised.  The CB1 H616 SoC includes a hardware IR receiver.  This resulted in a 85% success rate used in conjunction with the GPIO bit-banging IR transmitter.  While 85% may not seem great it was actually an improvement over the Pi4B using the software IR receiver.  Only the Rock 5B with it&#8217;s massive processing power managed a 100% success rate on the IR test so far.</p>



<p>Given that IR is subject to external interference, I believe that the CB1 would work for a project requiring an IR receiver.</p>



<h2 class="wp-block-heading" id="htoc-i2c-0-1">I2C (0/1)</h2>



<p>The H616 can support up to <em><strong>6</strong></em> TWI interfaces.  </p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p id="htoc-i-had-to-look-it-up-and-apparently-twi-is-electrically-compatible-with-i2c-it-appears-that-the-twi-two-wire-interface-was-created-to-avoid-trademark-issues">I had to look it up and apparently TWI is electrically compatible with I2C.  It appears that the &#8220;TWI&#8221; (Two-Wire-Interface) was created to avoid trademark issues.  </p>
</blockquote>



<p>While the SoC can support up to 6 there are only 2 pins exposed that connect to a TWI/I2C interface (per the H616 documentation).  That is PH0 and PH1.  These ALSO are the only two ports that connect to a UART interface.</p>



<p>I did test disabling the UART and testing the ports as TWI/I2C but to no avail.  I was unable to get it to pick up that I had any devices connected on the TWI/I2C bus.  Given that Bigtreetech didn&#8217;t include any overalys for the TWI/I2C I have to assume that there was some other board design choice that makes this impossible.</p>



<p>Bigtreetech DID provide an overlay to enable a software based I2C bus which works about as well as it did on the <a href="https://www.learningtopi.com/uncategorized/atomic-pi-pros-but-mostly-cons/">Atomic Pi</a>.  Which is to say, it works ok as long as your device is idle, but trying to use the soft I2C bus during the tests resulted in an 18% success in writing to the display.  The rest of the time I ended up with garbled text displaying.</p>



<p>I would avoid using software bit-banging I2C unless there is no other option.  From my experience the soft I2C and SPI drivers are error prone.</p>



<p>Also as a note the &#8220;biqu&#8221; default user wasn&#8217;t added to the i2c group.</p>



<p>A copy of overlay files I created are available on our GitHub files here:  <a href="https://learningtopi.github.io/cb1" target="_blank" rel="noreferrer noopener">https://learningtopi.github.io/cb1</a></p>



<h2 class="wp-block-heading" id="htoc-spi-1-2">SPI (1/2)</h2>



<p>I gave the CB1 one of two possible points.  This was because only ONE if the TWO SPI interfaces on the H616 were exposed on pins (SPI1 for some reason).  I was able to get the SPI bus to work with both my <a href="https://www.learningtopi.com/sbc/python_dht11_spi/" target="_blank" rel="noreferrer noopener">bmx280_spi</a> and <a href="https://www.learningtopi.com/sbc/python_dht11_spi/">dht11_spi</a> packages, but can&#8217;t use both at the same time (DHT11 setup causes a conflict which I&#8217;ll have to look into later).</p>



<p>Also once the overlay was enabled and the SPI devices were created the system wasn&#8217;t setup for anyone other than root.  Running the following and rebooting will resolve this issue.  It is an inconvienience that this isn&#8217;t setup out of the box.</p>



<pre class="wp-block-code"><code>groupadd spi 
echo 'SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"' &gt; /etc/udev/rules.d/99-spi.rules 
usermod -G spi -a biqu </code></pre>



<p>Last note on SPI, Bigtreetech provides an overlay to enable SPI1_cs0 and SPI1_cs1, however regardless if which one you use both CS0 and CS1 are enabled for SPI1.  After digging through the dtb files (using <code>fdtdump</code>) it appears that they are not propperly setting CS pins to disabled.  This CAN be done with an overlay (I tested it to verify), but it is a bit odd to provide specific SPI1_CS0 and SPI1_CS1 overlays if they aren&#8217;t being controlled individually.</p>



<p>A copy of overlay files I created are available on our GitHub files here:  <a href="https://learningtopi.github.io/cb1" target="_blank" rel="noreferrer noopener">https://learningtopi.github.io/cb1</a></p>



<h2 class="wp-block-heading" id="htoc-uart-0-1">UART (0/1)</h2>



<p>UART was an extreme disapointment.  Everything worked great up to 115200 baud.  Once I moved from 115200 to 230400 I started to see issues when receiveing on the UART interface (sending from the USB), however traffic going from UART to USB still worked.  At 460800 UART to USB failed far more often then not.  576000 and 921600 were a lost cause.</p>



<p>I did test moving the USB interface to my Rock 5B and just used <a href="https://pypi.org/project/pyserial/" target="_blank" rel="noreferrer noopener">pySerial</a> to send and receive back and forth.  I experienced the exact issues at the same speeds.  There has to be something either with the carrier board or the setup on the CB1 itself causing this problem.</p>



<p>I ended up with a 42% overall success rate which I consider a failure.  Unless you know you won&#8217;t need higher than a 115200 baud, I would suggest looking at a different platform.  Basically any other SBC.</p>



<h2 class="wp-block-heading" id="htoc-subjective-performance-1-2">Subjective Performance (1/2)</h2>



<p>Performance-wise, the CB1 feels pretty snappy.  I will note that I am running a trimmed down Debian Bookworm image from Bigtreetech with no GUI.  Given that we only have 1GB of RAM I would only consider this for a non-GUI headless system anyway.</p>



<p>I&#8217;ll also note that the positive performance may be partially due to the fact that Bigtreetech disabled CPU speed scaling in their kernel.  This may make some sense if you look at the board as a controller for a 3D printer, but for an IOT device this is not my ideal setup.  I mentioned earlier that the heatsink is really required and this is why.  This system runs HOT.  WAY hotter than other SBC&#8217;s given that this only has 4x A53 cores.</p>



<figure class="wp-block-gallery has-nested-images columns-default wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="485" height="669" data-id="1197" src="https://www.learningtopi.com/wp-content/uploads/rock5b-idle-temps.png" alt="" class="wp-image-1197" srcset="https://www.learningtopi.com/wp-content/uploads/rock5b-idle-temps.png 485w, https://www.learningtopi.com/wp-content/uploads/rock5b-idle-temps-217x300.png 217w, https://www.learningtopi.com/wp-content/uploads/rock5b-idle-temps-109x150.png 109w, https://www.learningtopi.com/wp-content/uploads/rock5b-idle-temps-300x414.png 300w" sizes="auto, (max-width: 485px) 100vw, 485px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="423" height="348" data-id="1196" src="https://www.learningtopi.com/wp-content/uploads/cb1-idle-temps.png" alt="" class="wp-image-1196" srcset="https://www.learningtopi.com/wp-content/uploads/cb1-idle-temps.png 423w, https://www.learningtopi.com/wp-content/uploads/cb1-idle-temps-300x247.png 300w, https://www.learningtopi.com/wp-content/uploads/cb1-idle-temps-150x123.png 150w" sizes="auto, (max-width: 423px) 100vw, 423px" /></figure>
</figure>



<p>For comparison, on the left is my Rock 5B which has the Rk3588 (4x A76 + 4x A55 cores) running at 52-53°C (125-127°F) compared to 57°C (134°F).  Both systems have a passive heatsink (albiet the Rock 5B has a much larger one).</p>



<p>Since they disabled CPU scaling in the kernel, as far as I know this means that the kernel can&#8217;t throttle the CPU if temperature reaches critical.</p>



<h2 class="wp-block-heading" id="htoc-ease-of-use-0-2">Ease of Use (0/2)</h2>



<p>I would say the biggest issue with usability is overlays.  There are only a handful available:</p>



<ul class="wp-block-list">
<li><strong>disable_uart0</strong>:<strong>  </strong>This one is pretty self explanitory and works as you would expect</li>



<li><strong>ir</strong>:  This one is also self explanitory and enables the IR receiver</li>



<li><strong>light</strong>:  Not clear why this is called &#8220;light&#8221;.  It disables UART0, enables the bit-banging I2C as well as the PWM.  Without dumping the DTBO file you really wouldn&#8217;t have a clue what this is doing</li>



<li><strong>mcp2515</strong>:  This one enables the mcp2515 CAN bus, but also SPI1.  Why SPI?  I am not familiar with CAN buses, but from the system overlay it appears that the mcp2515 is a sub-object to spi@5011000 (SPI1).</li>



<li><strong>pwm</strong>:  This enables the only available, PWM but DOESN&#8217;T disable the UART (which is on the same set of pins).  So make sure you also include <code>disable_uart0 </code>if you use this.</li>



<li><strong>spidev0_0</strong>:  Not sure why this is even here, SPI0 isn&#8217;t exposed on any pins</li>



<li><strong>spidev1_0, spidev1_1, spidev1_2</strong>: These are frustrating.  They all turn on SPI1 with 2x CS (0 and 1).  Under the spi@5011000 device, the cs pins are set uising the &#8220;cs-gpios&#8221; field.  None of these overlays edit this field.  You CAN edit or remove CS pins by creating your own overlay to edit this field, but having these overlays not do what they imply is confusing.</li>
</ul>



<p>The CB1 kernel DOES include the configfs which is a great feature to adding overlays after boot.  This doesn&#8217;t however overcome the lack of documentation, pins that aren&#8217;t connected, pins that are supposed to be connected and aren&#8217;t, lack of hardware I2C, single UART and overlaping functions on pins with no alternatives available.</p>



<p>If you decide to buy a CB1 for something other than running a 3D printer, be prepared to write your own overlay files.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p id="htoc-i">A copy of overlay files I created are available on our GitHub files here:  <a href="https://learningtopi.github.io/cb1" target="_blank" rel="noreferrer noopener">https://learningtopi.github.io/cb1</a></p>
</blockquote>



<h2 class="wp-block-heading" id="htoc-software-updates-1-2">Software Updates (1/2)</h2>



<p>The CB1 image I downloaded is a Debian Bookworm build which is very promising.  It appears that they are up to date on their distributions!  Bookworm (Debian 12) was only recently released.  The downside is the kernel.  The CB1 is running 5.16 which was NOT a long term train (5.15 was).  5.16 stopped receiving security updates <a href="https://endoflife.date/linux" target="_blank" rel="noreferrer noopener">over a year ago</a> (April 2022).  The bizzare thing is that they appear to have started with 5.16.17 in August of 2022 AFTER support was ended.  And they didn&#8217;t even start with the last release which was 5.16.20.</p>



<p>You may be able to keep the system up to date, but the kernel was out of support when they started.</p>



<h2 class="wp-block-heading" id="htoc-community-0-2">Community (0/2)</h2>



<p>I could find practically no community for the CB1.  The first discussion board I found for the CB1 (<a href="https://github.com/bigtreetech/CB1/discussions" target="_blank" rel="noreferrer noopener">https://github.com/bigtreetech/CB1/discussions</a>) says it is abandoned (not a good start) and only has a handful of discussions from 2022.  The link at the top of this discussion board linked to another discussion board (<a href="https://github.com/bigtreetech/CB1/discussions/8" target="_blank" rel="noreferrer noopener">https://github.com/bigtreetech/CB1/discussions/8</a>) that ALSO says it is abandoned.  This page had a total of 6 comments and 9 replies.  This just takes you to a discussion for the Bullseye minimal image (which I&#8217;m not even running): <a href="https://github.com/bigtreetech/CB1/discussions/9" target="_blank" rel="noreferrer noopener">https://github.com/bigtreetech/CB1/discussions/9</a>.  Again here there was still only 25 comments and 43 replies.</p>



<p>Don&#8217;t expect to find a lot of community feedback for this board.</p>



<h2 class="wp-block-heading" id="htoc-issues">Issues</h2>



<h3 class="wp-block-heading" id="htoc-security-groups-and-udev-not-setup-for-i2c-and-spi">Security Groups and UDEV not setup for I2C and SPI</h3>



<p>I mentioned under the <a href="#htoc-i2c-0-1">I2C</a> section that the <code>biqu</code> default user wasn&#8217;t in the <code>i2c</code> user group.  For <a href="#htoc-spi-1-2">SPI</a>, devices were created with only root access.  I had to create the <code>spi</code> group, create a <code>udev</code> rule and add the <code>biqu</code> user to the <code>spi</code> group.  While this is not extraordinarily complicated to do, if you are are not familiar with the udev rules it may take some time to setup non-root access.  More mature SBC platforms have this configured out of the box ready to use.</p>



<h3 class="wp-block-heading" id="htoc-no-i2c-only-overlay">No I2C only overlay</h3>



<p>Also in the <a href="#htoc-i2c-0-1">I2C</a> section I called out the lack of a dedicated I2C overlay (even though it is a bit-banging software overlay and not a hardware one).  The &#8220;light&#8221; and &#8220;tft&#8221; overlays turn on I2C in addition to other functions that you may or may not want.  (For example &#8220;tft&#8221; also disables the HDMI port, &#8220;light&#8221; disables the only UART and enables PWM in its place.)</p>



<p>There is of course nothing stopping you from creating your own overlay files.  The CB1 uses a <code>boot.cmd</code> UBOOT script that includes a check for user provided overlays.  Simply create the <code>/boot/overlay-user</code> directory and place your compiled DTBO files here.  In the <code>BoardEnv.txt</code> file, add a line for user_overlays.  Then just add a space separated list of overlays you want to create.</p>



<h3 class="wp-block-heading" id="htoc-pins-that-don-t-work-pg6-pg7-pg8-pg9">Pins that don&#8217;t work (PG6, PG7, PG8, PG9)</h3>



<p>For some unknown reason these 4 pins just wouldn&#8217;t work.  They are documented in the pinout, I could reserve the pins but setting them high or low had no affect.  Using my oscilliscope I was never able to get a signal on these pins.  All I get is background static the same as I get on the pins that Bigtreetech marked as &#8220;not connected&#8221;.  Not sure why these pins don&#8217;t work since they are listed on the schematic (<a href="https://github.com/bigtreetech/CB1/blob/master/Hardware/BIGTREETECH_CB1_V22_220812_SCH.pdf">https://github.com/bigtreetech/CB1/blob/master/Hardware/BIGTREETECH_CB1_V22_220812_SCH.pdf</a>) on connector A1-100.</p>



<h3 class="wp-block-heading" id="htoc-uart0-overlaps-with-twi-and-pwm">UART0 overlaps with TWI and PWM</h3>



<p>The PH0 and PH1 pins are the only pins that can be used for UART0, TWI (I2C although I still couldn&#8217;t get this to work) and PWM.  You get to pick one of these three functions.  None of the other connected pins support any of these functions (other than running the soft I2C driver).  This is severly limiting in terms of what functions are available.</p>



<h3 class="wp-block-heading" id="htoc-uart0-doesn-t-work-over-115200">UART0 doesn&#8217;t work over 115200</h3>



<p>I was not able to figure out what caused this, but the only UART interface doesn&#8217;t work consistently (or at all) over 115200 baud.  While this may work for some projects, it does show that SOMETHING is wrong design wise.  Unfortunately I don&#8217;t have another board with an H616 for comparison so I don&#8217;t know if this is an Allwinner H616 chip level issue or if this is a Bigtreetech CB1 issue.</p>



<h3 class="wp-block-heading" id="htoc-pull-up-pull-down-resistor-inconsistancy">Pull-up / Pull-down Resistor Inconsistancy</h3>



<p>I covered this above (<a href="#htoc-pull-up-pull-down-resistors">#htoc-pull-up-pull-down-resistors</a>).  Some pins use different pull-up and pull-down resistors.  This caused my input button setup on my breadboard not to function at all on certain pins.  After I swapped the resistor I was using to the 3.3V rail it worked fine, it just took some time to sort out what the issue was.  I have not run across this particular setup on other SoC&#8217;s.  I&#8217;ll be on the lookout from now on.</p>



<h2 class="wp-block-heading" id="htoc-overall-5-14">Overall (5/14)</h2>



<p>If you consider the original intended purpose of this board (to run a 3D printer), most of the issues and problems I ran across are probably non-issues.  Trying to use this board as a general IOT device is far more problematic.  The lack of functions exposed on pins make it extremely hard to find a good use for this device.  The only 2 things that I didn&#8217;t have any major issues with was SPI (other than missing udev setup and security groups) and IR.  I2C is software based, the UART didn&#8217;t work consistently (or at all) over 115200 and 4 of the GPIO&#8217;s documented in their notes wouldn&#8217;t work.  There are also 6 pins that just aren&#8217;t connected to anything (on TOP of the 4 I couldn&#8217;t get to work).</p>



<p>All in all I would say if you aren&#8217;t planning to use this for a 3D printer I would suggest looking for an alternative.  It may work for some specific use cases, but you will likely need to recompile the kernel to get CPU throttling turned back on and you have limited IO functionality.</p>



<p>A copy of overlay files I created are available on our GitHub files here:  <a href="https://learningtopi.github.io/cb1" target="_blank" rel="noreferrer noopener">https://learningtopi.github.io/cb1</a></p>
<p>The post <a href="https://www.learningtopi.com/sbc/cb1/bigtreetech-cb1/">Bigtreetech CB1</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/cb1/bigtreetech-cb1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Atomic Pi Pros, but mostly Cons</title>
		<link>https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/</link>
					<comments>https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Wed, 19 Jul 2023 04:54:33 +0000</pubDate>
				<category><![CDATA[Atomic Pi]]></category>
		<category><![CDATA[SBC]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=1145</guid>

					<description><![CDATA[<p>I purchased the Atomic Pi at a stellar price. Currently you can still get it for $50 at Amazon with the camera and breakout board. An incredible price for an x86_64 SBC! The Atomic Pi does have some Pros, but mostly cons. I&#8217;ll walk through what I found here. Scoring and Specs Here is a...</p>
<p>The post <a href="https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/">Atomic Pi Pros, but mostly Cons</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I purchased the Atomic Pi at a stellar price.  Currently you can still get it for <a href="https://www.amazon.com/DLI-APi-Atomic-Developers-Kit/dp/B08CGFM2B1/ref=sr_1_2?crid=2NNPYC6CAA4F1&amp;keywords=atomic+pi&amp;qid=1689315435&amp;sprefix=atomicpi%2Caps%2C133&amp;sr=8-2" target="_blank" rel="noreferrer noopener">$50 at Amazon</a> with the camera and breakout board.  An incredible price for an x86_64 SBC!  The Atomic Pi does have some Pros, but mostly cons.  I&#8217;ll walk through what I found here.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<div class="wp-block-ht-block-toc  is-style-outline htoc htoc--position-left toc-list-style-plain" data-htoc-state="expanded"><span class="htoc__title"><span class="ht_toc_title">Table of Contents</span></span><div class="htoc__itemswrap"><ul class="ht_toc_list"><li class=""><a href="#htoc-s">Scoring and Specs</a></li><li class=""><a href="#htoc-sbc-scoring-results">SBC Scoring Results</a></li><li class=""><a href="#htoc-gpio-s">GPIO&#8217;s (1/1)</a><ul class="ht_toc_child_list"><li class=""><a href="#htoc-updated-gpio-table">Updated GPIO Table</a></li><li class=""><a href="#htoc-major-limitations">Major GPIO limitations:</a></li></ul></li><li class=""><a href="#htoc-ir-0-1">IR (0/1)</a></li><li class=""><a href="#htoc-i2c-0-1"> I2C (0/1)</a></li><li class=""><a href="#htoc-spi-1-1">SPI (0/2)</a></li><li class=""><a href="#htoc-uart-1-1">UART (1/1)</a></li><li class=""><a href="#htoc-subjective-performance-1-2">Subjective Performance (1/2)</a></li><li class=""><a href="#htoc-e">Ease of Use (1/2)</a></li><li class=""><a href="#htoc-software-updates-1-2">Software Updates (1/2)</a></li><li class=""><a href="#htoc-community-0-2">Community (0/2)</a></li><li class=""><a href="#htoc-issues">Issues</a><ul class="ht_toc_child_list"><li class=""><a href="#htoc-power-issues">Power Issues</a></li><li class=""><a href="#htoc-cmos-battery">CMOS Battery</a></li><li class=""><a href="#htoc-emmc">eMMC</a></li></ul></li><li class=""><a href="#htoc-overall-5-14">Overall (5/14)</a></li></ul></div></div>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="712" height="547" src="https://www.learningtopi.com/wp-content/uploads/2022/04/atompic-pi.jpg" alt="" class="wp-image-75" srcset="https://www.learningtopi.com/wp-content/uploads/2022/04/atompic-pi.jpg 712w, https://www.learningtopi.com/wp-content/uploads/2022/04/atompic-pi-300x230.jpg 300w, https://www.learningtopi.com/wp-content/uploads/2022/04/atompic-pi-150x115.jpg 150w" sizes="auto, (max-width: 712px) 100vw, 712px" /></figure>
</div>
</div>



<h2 class="wp-block-heading" id="htoc-s">Scoring and Specs</h2>



<p>Here is a breakdown of the scoring.  I&#8217;ll cover each section below to describe how I came to the numbers.</p>



<h2 class="wp-block-heading" id="htoc-sbc-scoring-results">SBC Scoring Results</h2>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<table id="tablepress-10-no-3" class="tablepress tablepress-id-10">
<thead>
<tr class="row-1">
	<th class="column-1" style="width:50%;">Category</th><th class="column-2" style="width:50%;">Atomic Pi</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">Tests &#8211; GPIO&#8217;s (1pt)</td><td class="column-2">1/1</td>
</tr>
<tr class="row-3">
	<td class="column-1">Tests &#8211; IR (1pt)</td><td class="column-2">0/1</td>
</tr>
<tr class="row-4">
	<td class="column-1">Tests &#8211; I2C (1pt)</td><td class="column-2">0/1</td>
</tr>
<tr class="row-5">
	<td class="column-1">Tests &#8211; SPI (2pt)</td><td class="column-2">0/2</td>
</tr>
<tr class="row-6">
	<td class="column-1">Tests &#8211; UART (1pt)</td><td class="column-2">1/1</td>
</tr>
<tr class="row-7">
	<td class="column-1">Subjective Performance (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-8">
	<td class="column-1">Ease of Use (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-9">
	<td class="column-1">Software Updates (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-10">
	<td class="column-1">Community (2pt)</td><td class="column-2">0/2</td>
</tr>
</tbody>
<tfoot>
<tr class="row-11">
	<th class="column-1">Overall (14pt)</th><th class="column-2">5/14</th>
</tr>
</tfoot>
</table>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<p>Scoring the SBC for comparison purposes. Scoring will be based on the following criteria:<br><strong>&#8211; GPIO (1pt) &#8211;</strong> LED and button tests passed and there are at least 8 usable GPIO&#8217;s<br><strong>&#8211; I2C (1pt) &#8211;</strong> I2C display tests passed<br><strong>&#8211; SPI (1pt) &#8211;</strong> SPI tests passed (BME280 and DHT11 over SPI)<br><strong>&#8211; UART (1pt) &#8211;</strong> UART tests passed and multiple UARTs are available<br><strong>&#8211; Subjective Performance (1pt) &#8211;</strong> Was the system responsive and functional overall<br><strong>&#8211; Ease of Use (1pt) &#8211;</strong> How easy was it to setup and use for the sbc_gpio tests? Can it be reconfigured quickly?<br><strong>&#8211; Software Updates (2pt) &#8211;</strong> How frequently does the system get updates? 1pt for base system, 1pt for kernel<br><strong>&#8211; Community (2pt) &#8211;</strong> Finding answers to questions, getting recommendations and help is an important part of using a SBC</p>
</div>
</div>



<p>The specifications for the Atomic Pi that I was able to collect are available below:</p>



<table id="tablepress-6-no-4" class="tablepress tablepress-id-6">
<thead>
<tr class="row-1">
	<td class="column-1" style="width:20%;"></td><th class="column-2" style="width:80%;">Atomic Pi</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">CPU</td><td class="column-2">Intel Atom x5-Z8350<br />
4 Core (480Mhz &#8211; 1.92Ghz)</td>
</tr>
<tr class="row-3">
	<td class="column-1">NPU</td><td class="column-2">N/A</td>
</tr>
<tr class="row-4">
	<td class="column-1">Memory</td><td class="column-2">2GB DDR3L-1600 </td>
</tr>
<tr class="row-5">
	<td class="column-1">GPU</td><td class="column-2">Intel Integrated HD Graphics<br />
12 execution units (200-500Mhz)</td>
</tr>
<tr class="row-6">
	<td class="column-1">Video Decoding</td><td class="column-2">H.263, MPEG4, H.264, H.265 (HEVC,8bit), VP8, VP9, MVC, MPEG2, VC1, JPEG</td>
</tr>
<tr class="row-7">
	<td class="column-1">Video Encoding</td><td class="column-2">H.264, H.263, VP8, MVC, JPEG</td>
</tr>
<tr class="row-8">
	<td class="column-1">GPU FP16/FP32/FP64</td><td class="column-2">? / 17.8 / ? GFLOPS</td>
</tr>
<tr class="row-9">
	<td class="column-1">Video Out</td><td class="column-2">1x HDMI</td>
</tr>
<tr class="row-10">
	<td class="column-1">Video In</td><td class="column-2">5pin webcam connector (can be used for USB 2.0)</td>
</tr>
<tr class="row-11">
	<td class="column-1">Storage</td><td class="column-2">16GB eMMC<br />
MicroSD</td>
</tr>
<tr class="row-12">
	<td class="column-1">USB</td><td class="column-2">1x USB 3.0 Type-A (on CPU board)<br />
1x USB 2.0 Type-A (on carrier board)</td>
</tr>
<tr class="row-13">
	<td class="column-1">PCIe</td><td class="column-2">N/A</td>
</tr>
<tr class="row-14">
	<td class="column-1">Networking</td><td class="column-2">1Gbps Realtek RTL8111G-CG<br />
MediaTek RT5572 2.5/5GHz/2&#215;2 MMC connectors (requires external antenna not included)</td>
</tr>
<tr class="row-15">
	<td class="column-1">Bluetooth</td><td class="column-2">CSR CSR8510</td>
</tr>
<tr class="row-16">
	<td class="column-1">I2C</td><td class="column-2">Software only &#8211; configurable on GPIO</td>
</tr>
<tr class="row-17">
	<td class="column-1">SPI</td><td class="column-2">Software only &#8211; configurable on GPIO</td>
</tr>
<tr class="row-18">
	<td class="column-1">UART</td><td class="column-2">3x (fixed, GPIO pins can&#8217;t be re-purposed)</td>
</tr>
<tr class="row-19">
	<td class="column-1">PWM</td><td class="column-2">N/A</td>
</tr>
<tr class="row-20">
	<td class="column-1">ADC (analog to digital)</td><td class="column-2">N/A</td>
</tr>
<tr class="row-21">
	<td class="column-1">CAN Bus</td><td class="column-2">N/A</td>
</tr>
<tr class="row-22">
	<td class="column-1">General GPIO / Other</td><td class="column-2">8x (6x + 2x for volume control that can be used as GPIO) + BNO055 (accelerometer, gyroscope, geomagnetic sensor)</td>
</tr>
<tr class="row-23">
	<td class="column-1">Power</td><td class="column-2">5v DC 3-4A (power from 26pin connector on CPU board, or from a carrier board)</td>
</tr>
<tr class="row-24">
	<td class="column-1">Kernel Support</td><td class="column-2">Supports Windows 10<br />
Digital Loggers image runs Linux 5.4</td>
</tr>
<tr class="row-25">
	<td class="column-1">Purchase Links</td><td class="column-2"><a href="https://www.amazon.com/DLI-APi-Atomic-Developers-Kit/dp/B08CGFM2B1/ref=sr_1_2?crid=2NNPYC6CAA4F1&amp;keywords=atomic+pi&amp;qid=1689315435&amp;sprefix=atomicpi%2Caps%2C133&amp;sr=8-2" target="_blank" rel="noopener">Amazon</a></td>
</tr>
</tbody>
</table>



<h2 class="wp-block-heading" id="htoc-gpio-s">GPIO&#8217;s (1/1)</h2>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<p>The main set of IO on the breakout board is the 11 screw terminals that connect off the 26-pin plug on the bottom of the main board.  Here we have the following:</p>



<ul class="wp-block-list">
<li>6x general GPIO pins
<ul class="wp-block-list">
<li>GPIO1 and GPIO2 also connect to LEDs on the breakout board</li>
</ul>
</li>



<li>2x UART (RXD1/TXD1 and RXD2/TXD2)
<ul class="wp-block-list">
<li>These <strong>CANNOT </strong>be repurposed</li>
</ul>
</li>
</ul>



<p>In addition to the main IO block, there are two additional 3-pin blocks on the back of the board.  J9 has 2 pins for volume that can be repurposed as general GPIO&#8217;s.  J10 has another UART (also <strong>CANNOT </strong>be repurposed).</p>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="224" height="255" src="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio.png" alt="" class="wp-image-1155" srcset="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio.png 224w, https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio-132x150.png 132w" sizes="auto, (max-width: 224px) 100vw, 224px" /></figure>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio2.png" alt="" class="wp-image-1156" width="254" height="146" srcset="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio2.png 254w, https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio2-150x86.png 150w" sizes="auto, (max-width: 254px) 100vw, 254px" /></figure>



<p>Schematics here: <a href="https://www.digital-loggers.com/enchillada.pdf" target="_blank" rel="noreferrer noopener">https://www.digital-loggers.com/enchillada.pdf</a></p>
</div>
</div>



<p>I&#8217;ll note this again later with documentation, but the GPIO info listed in the official documentation appears to be wrong.  The main GPIO documentation (<a href="https://download.fosc.space/atomic_pi/guide/html/gpio.html" target="_blank" rel="noreferrer noopener">https://download.fosc.space/atomic_pi/guide/html/gpio.html</a>) says that the GPIO&#8217;s are on GPIO chip 3, when they are actually on GPIO chip 2.  It DOES list global pin numbers that are correct, but modern Python libraries using gpiod use the Chip/Pin combo which threw my testing for a loop.</p>



<h3 class="wp-block-heading" id="htoc-updated-gpio-table">Updated GPIO Table</h3>



<figure class="wp-block-table"><table><tbody><tr><td><strong>Name</strong></td><td><strong>Chip</strong></td><td><strong>Pin</strong></td><td><strong>Global Pin</strong></td><td><strong>Connected Devices</strong></td></tr><tr><td>GPIO0</td><td>2</td><td>21</td><td>335</td><td>Breakout Board Green LED (active LOW)</td></tr><tr><td>GPIO1</td><td>2</td><td>18</td><td>332</td><td>Breakout Board Yellow LED (active LOW)</td></tr><tr><td>GPIO2</td><td>2</td><td>24</td><td>338</td><td></td></tr><tr><td>GPIO3</td><td>2</td><td>15</td><td>329</td><td></td></tr><tr><td>GPIO4</td><td>2</td><td>22</td><td>336</td><td></td></tr><tr><td>GPIO7</td><td>2</td><td>16</td><td>330</td><td></td></tr><tr><td>GPIO_DFX_2</td><td>1</td><td>7</td><td>348</td><td>Volume Up</td></tr><tr><td>GPIO_DFX_4</td><td>1</td><td>5</td><td>346</td><td>Volume Down</td></tr></tbody></table></figure>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<p>The Green and Yellow LEDs are connected to VCC3 (3.3v) and the GPIO through a 1k resistor.  Using GPIO1 and GPIO2 as an input is essentially impossible as these GPIO&#8217;s will be pulled high at all times.</p>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="251" height="135" src="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio-led-2.png" alt="" class="wp-image-1160" srcset="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio-led-2.png 251w, https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio-led-2-150x81.png 150w" sizes="auto, (max-width: 251px) 100vw, 251px" /></figure>
</div>
</div>



<h3 class="wp-block-heading" id="htoc-major-limitations">Major GPIO limitations:</h3>



<ul class="wp-block-list">
<li>As noted, UART pins cannot be reused as GPIO</li>



<li>There are no pull up/pull down options available (can&#8217;t say if the hardware itself is capable, there does not appear to be any way to set it using the 5.4 kernel that the Atomic Pi is running).  External pull up/down must be used</li>



<li>Limited numbers &#8211; only 8 total GPIO&#8217;s can be used</li>



<li>GPIO1 and GPIO2 are connected to 3.3v via the LEDs which means they are usable for output only.</li>
</ul>



<p>I am technically passing the GPIO category, since there are 8 usable GPIO&#8217;s, but the limitations make it a tough call.</p>



<h2 class="wp-block-heading" id="htoc-ir-0-1">IR (0/1)</h2>



<p>Enabling the GPIO UART was relatively simple.  The 5.4 kernel has compiled in a patch that exposes the ability to create and delete (although deleting is not recommended) overlays on the fly.  This means we just needed to create the DTS files, compile them, then load using the following:</p>



<pre class="wp-block-code"><code>sudo mkdir /sys/kernel/config/device-tree/overlays/{overlay-name}
sudo cat {overlay}.dtbo &gt; /sys/kernel/config/device-tree/overlays/{overlay-name}/dtbo</code></pre>



<p>You can find copy of the DTS files as well as the application script on our GitHub:  <a href="https://github.com/LearningToPi/learningtopi.github.io/tree/main/files/atomicpi" target="_blank" rel="noreferrer noopener">https://github.com/LearningToPi/learningtopi.github.io/tree/main/files/atomicpi</a></p>



<p>Applying the overlay was simple, however the receiver would only occasionally pick up the transmitted signal.  I was a bit surprised at this but given other issues didn&#8217;t see digging deeper as necessary.</p>



<h2 class="wp-block-heading" id="htoc-i2c-0-1"> I2C (0/1)</h2>



<p>The Atomic Pi has no hardware I2C or SPI capabilities.  Digital Logger provides a software-based driver that can be used to create I2C or SPI on the limited number of GPIOs.  The I2C driver uses a daemon to load overlays based on files located in the <code>/etc/i2c-gpio-custom.d</code> folder.  There is an existing bus for the BNO055 sensor built into the board.  You can&#8217;t use the  I2C bus used for the BNO055, so simply create a new file and provide the parameters outlined in the README file.  I used pins 476 and 480 for my SDA and SCL pins (creating a new bus 41).  Simply restart the board or restart the daemon:</p>



<pre class="wp-block-code"><code>sudo systemctl restart i2c-gpio-custom</code></pre>



<p>The I2C bus shows up, and I&#8217;m able to see the device using <code>i2cdetect</code>.  I am also able to connect to my 16&#215;2 LCD and write content to the display!  However, as soon as I loaded up the system with other tasks (in particular the IR) the number of successful writes to the I2C device plummeted.  In the end a 52% success rate was all I could manage with IR enabled.  Also note that due to the lack of GPIO&#8217;s, I was unable to run I2C and SPI at the same time.  The best I could manage was simple GPIO in and out, UART and I2C together.</p>



<p>Please note that even the aged Raspberry Pi 3B+ is able to run the I2C bus with no issues since there is a hardware controller available.  I have found numerous posts on the internet of people having success with I2C on the Atomic Pi, so before you call foul, your experience will vary depending on how busy the system is with other tasks.  I wouldn&#8217;t depend on the software driver.</p>



<h2 class="wp-block-heading" id="htoc-spi-1-1">SPI (0/2)</h2>



<p>The SPI driver works exactly the same as the I2C above.  The SPI driver is configured using files in the <code>/etc/spi-gpio-custom.d</code> folder.  Here you need to provide a bit more info.  This includes a bus ID (0), CLK (335), MOSI (329), MISO (336), mode (0), max frequency (500,000), and CS pin (338).  Restarting the service or the board will create your SPI bus:</p>



<pre class="wp-block-code"><code>sudo systemctl restart spi-gpio-custom</code></pre>



<p>For reasons unknown this well for my BME280 sensor with no load.  Under load I saw that the reads were successful, but the BME280 sensor was reporting my office was below freezing or approaching the boiling point of water.  This is most likely due to bits getting flipped or mismatches in the timing.  I would say that it is hard to trust your sensor data if you are reading over a software SPI interface.</p>



<p>When attempting to use my DHT22 over SPI (<a href="https://www.learningtopi.com/sbc/python_dht11_spi/">Python dht11_spi</a> for details if this is new for you) was a complete failure.  From what I can gather, the software SPI bus is not able to process the data quickly enough.</p>



<h2 class="wp-block-heading" id="htoc-uart-1-1">UART (1/1)</h2>



<p>With UART we had great success!  There are 3 available HARDWARE UART ports available.  Two are available on the main breakout (J1) and one on the debug header (CN10).  I left the debug header as a console interface and used UART1 on the breakout.</p>



<p>Traffic between the UART and USB CP2102 ran perfectly in both directions.  With IR running I consistently saw 98% success (out of 14760 tests).  With IR disabled it went to 100%.  I can say that this was a complete success and performs even better than the RPi4B did.</p>



<p>UART was the ONLY test that passed with flying colors.</p>



<h2 class="wp-block-heading" id="htoc-subjective-performance-1-2">Subjective Performance (1/2)</h2>



<p>This category is a bit open.  I have 3 possible values:</p>



<ul class="wp-block-list">
<li>0:  The system is extraordinarily slow.  It may be functional, but performance was an issue</li>



<li>1:  The system works about like we would expect from an SBC.  It was not excessivly slow and booted quickly.  However, it doesn&#8217;t have any &#8220;wow&#8221;.</li>



<li>2:  This is reserved for the &#8220;wow&#8221; devices.  So far one device (the Radxa Rock 5B) fits into this category.</li>
</ul>



<p>The Atomic Pi boots relatively quick.  The BIOS POST is certainly slower than UBOOT on an ARM device.  Out of the box the Atomic Pi comes with a built-in eMMC that was significantly quicker than a Micro SD Card and gave it a bit of an edge in performance.  However, the eMMC failed and left me with SD.  I&#8217;ll talk about the eMMC under the problems category below.</p>



<h2 class="wp-block-heading" id="htoc-e">Ease of Use (1/2)</h2>



<p>This wasn&#8217;t hard to grade.  The software SPI and I2C buses are easy to set up and use.  The sysfs driver for the overlays makes adding overlays for IR easy.  Since we don&#8217;t have the ability to load overlays during the boot process on x86 like we do with ARM this is a must have.</p>



<p>I did have to doc a point for incorrect documentation.  Not having correct GPIO Chip / Pin numbers listed for the few GPIOs that are available made using the system significantly more difficult than it should have been.</p>



<h2 class="wp-block-heading" id="htoc-software-updates-1-2">Software Updates (1/2)</h2>



<p>This was a tough category.  Given the issues that I have seen of late in the IOT world, any project should be able to be maintained and updated with security patches.  On the plus side, as an x86 board, the Atomic Pi can run vanilla Ubuntu or really any other distribution that you want.  The DOWNSIDE is that to maintain the &#8220;ease of use&#8221; we talked about above; you need to run the Digital Loggers kernel and here is where the problem comes in.  The kernel is 5.4.30 and doesn&#8217;t appear to ever get updated.  Digital Loggers GitHub does NOT have a repo for their kernel either.</p>



<p>5.4 is a long-term release, but 5.4.30 is from April in 2020.  Since it is July 2023, it seems likely that this isn&#8217;t being actively maintained.  This leaves you with a choice:</p>



<ol class="wp-block-list">
<li>Keep the functionality for I2C/SPI and the ability to load overlays</li>



<li>Keep your system up to date on a supported kernel</li>
</ol>



<h2 class="wp-block-heading" id="htoc-community-0-2">Community (0/2)</h2>



<p>I was able to find others that had purchased and used this board, but don&#8217;t expect anything like the community available for Raspberry Pi products.  There is really only one &#8220;community&#8221; page here: <a href="http://ehxz.tk/atomicpi" target="_blank" rel="noreferrer noopener">http://ehxz.tk/atomicpi</a>.  There are some downloads available with different Ubuntu / Debian images as well as BIOS files, but that&#8217;s really about it.  Don&#8217;t expect a large community with examples to pull from.</p>



<h2 class="wp-block-heading" id="htoc-issues">Issues</h2>



<p>During setup, testing, or normal usage I ran into a few problems.</p>



<h3 class="wp-block-heading" id="htoc-power-issues">Power Issues</h3>



<p>I tried using Pi 4B adapters and numerous other 5V power supplies to no avail.  I even tried running the power directly into the pins on the bottom of the board (bypassing the breakout).  The documentation says to use MULTIPLE pins if powering directly, which made me leery.  In the end I ended up using my bench power supply (an <a href="https://www.amazon.com/gp/product/B07WNXY6T5/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1" target="_blank" rel="noreferrer noopener">EVGA SuperNova 550</a> ATX power supply).</p>



<p>I did find several other power supplies that would work, but quickly ran into stability issues (Atomic Pi would simply lock up after running for a period of time).  Once I had the power sorted out, I had no issues with locking up.</p>



<h3 class="wp-block-heading" id="htoc-cmos-battery">CMOS Battery</h3>



<p>Since the Atomic Pi is basically just a small Intel computer, it has a CMOS battery.  Mine was dead out of the box and resulted in a reset of the BIOS and clock every time I removed power.  I couldn&#8217;t find one with a matching plug, so ended up splicing a new battery in.</p>



<h3 class="wp-block-heading" id="htoc-emmc">eMMC</h3>



<p>I was happy that the Atomic Pi came with a built-in eMMC.  These aren&#8217;t typically super fast but are generally way faster than running from an SD card.  The downside here is that my eMMC went belly up after a while and stopped being recognized in the BIOS.  I followed all the instructions I found on the web and couldn&#8217;t get it back working again.  Eventually I gave up and reverted to an SD card.</p>



<p>I suppose if I ever decide to use this device long term, I could connect an external USB to eMMC similar to what I do with the Raspberry Pi 4B.  SD cards are just not fast enough to run a graphical interface.  Headless systems might work well enough, but GUI&#8217;s will just slow the system to a crawl.</p>



<h2 class="wp-block-heading" id="htoc-overall-5-14">Overall (5/14)</h2>



<p>Overall, I would say that the Atomic Pi performs poorly in most circumstances.  There are a few use cases though that I think the Atomic Pi could really shine (particularly given the low price):</p>



<ul class="wp-block-list">
<li>If you MUST have x86 for software binary compatibility</li>



<li>If you need to run Windows (NOTE:  I didn&#8217;t test any GPIO / I2C or SPI under Windows)</li>



<li>If you have a project that needs 3x UARTs and only a couple of GPIOs</li>
</ul>



<p>Unless you fit in the use cases above, you could probably do better with another system.  As I wrap up testing on a range of different platforms, I&#8217;ll add a page to compare and contrast the different systems available.</p>
<p>The post <a href="https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/">Atomic Pi Pros, but mostly Cons</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>sbc_gpio: Pi 4B vs Rock 5B</title>
		<link>https://www.learningtopi.com/sbc/sbc_gpio-pi-4b-vs-rock-5b/</link>
					<comments>https://www.learningtopi.com/sbc/sbc_gpio-pi-4b-vs-rock-5b/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Wed, 21 Jun 2023 05:56:44 +0000</pubDate>
				<category><![CDATA[Raspberry Pi SBC]]></category>
		<category><![CDATA[Rock5B]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[Pi4B]]></category>
		<category><![CDATA[python sbc_gpio]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=994</guid>

					<description><![CDATA[<p>One of my goals over the past couple of years has been to find a suitable replacement for the Raspberry Pi 4B as supplies have been low and costs have been high.&#160; During the past couple of years, I’ve purchased several different boards to test out.&#160; Now that I have a GPIO abstraction layer and...</p>
<p>The post <a href="https://www.learningtopi.com/sbc/sbc_gpio-pi-4b-vs-rock-5b/">sbc_gpio: Pi 4B vs Rock 5B</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>One of my goals over the past couple of years has been to find a suitable replacement for the Raspberry Pi 4B as supplies have been low and costs have been high.&nbsp; During the past couple of years, I’ve purchased several different boards to test out.&nbsp; Now that I have a GPIO abstraction layer and test library (you can read about it <a href="https://www.learningtopi.com/tag/python-sbc_gpio/">here</a> or read the library documentation <a href="https://www.learningtopi.com/tag/python-sbc_gpio/">here</a>) I am ready to start sharing some results.  So without further ado, here is the first installment of the sbc_gpio: Pi 4B vs Rock 5B.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-1024x385.jpg" alt="" class="wp-image-80" width="508" height="191" srcset="https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-1024x385.jpg 1024w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-300x113.jpg 300w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-150x56.jpg 150w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-768x289.jpg 768w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-1536x578.jpg 1536w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-2048x770.jpg 2048w" sizes="auto, (max-width: 508px) 100vw, 508px" /></figure>
</div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/500px-Rock5b-v142-angel.jpg" alt="" class="wp-image-468" width="309" height="258"/></figure>
</div></div>
</div>



<p>The purpose of the comparisons is not to showcase CPU, memory, NIC’s etc.&nbsp; The test library I’ll be using is intended to test GPIO and other functionality from Python.&nbsp; The idea is to compare the setup and functionality of the following:</p>



<ul class="wp-block-list">
<li><strong>IR </strong>– using LIRC to both send and receive an infrared signal</li>



<li><strong>BMX </strong>– using SPI to read from a BME280 or BMP280 sensor</li>



<li><strong>I2C_DISPLAY </strong>&#8211;&nbsp; writes content to an 16&#215;2 LCD display connected via I2C</li>



<li><strong>DHT_SPI </strong>– uses the SPI bus to read from a DHT11 or DHT22.  See the <a href="https://www.learningtopi.com/sbc/python_dht11_spi/" target="_blank" rel="noreferrer noopener">DHT11_SPI </a>class for more details on how to set this up</li>



<li><strong>LED </strong>– Flash an LED using the GPIO</li>



<li><strong>BUTTON </strong>– Watch for input on a GPIO</li>



<li><strong>UART </strong>– Send and receive data between a UART and USB to serial adapter</li>
</ul>



<p>The purpose of the test isn’t to compare CPU and memory specs, but it is good to start with an understanding of how the hardware stacks up.</p>



<h2 class="wp-block-heading">Hardware Specs</h2>



<table id="tablepress-6-no-5" class="tablepress tablepress-id-6">
<thead>
<tr class="row-1">
	<td class="column-1" style="width:20%;"></td><th class="column-2" style="width:40%;">Raspberry Pi 4B</th><th class="column-3" style="width:40%;">Radxa Rock 5B</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">CPU</td><td class="column-2">Broadcom BCM2711<br />
4x ARM Cortex-A72 (600Mhz &#8211; 1.8GHz)</td><td class="column-3">Rockchip RK3588<br />
4x ARM Cortex-A76 (408Mhz &#8211; 2.4Ghz)<br />
4x ARM Cortex-A55 (408Mhz &#8211; 1.8Ghz)</td>
</tr>
<tr class="row-3">
	<td class="column-1">NPU</td><td class="column-2">N/A</td><td class="column-3">6 TOPS  INT4/INT8/INT16/FP16<br />
TensorFlow/MXNet/PyTorch/Caffe can be easily converted<br />
300Mhz &#8211; 1Ghz (per /sys/class/devfreq/fdab0000.npu/available_frequencies</td>
</tr>
<tr class="row-4">
	<td class="column-1">Memory</td><td class="column-2">1/2/4/8GB LPDDR4 3200Mhz 32-bit bus</td><td class="column-3">4/8/16GB LPDDR4 2112Mhz 64-bit bus</td>
</tr>
<tr class="row-5">
	<td class="column-1">GPU</td><td class="column-2">Broadcom VideoCore VI <br />
4 cores (200 &#8211; 500Mhz)</td><td class="column-3">ARM Mali-G610 MP4 3D GPU<br />
4 cores (300Mhz &#8211; 1Ghz)</td>
</tr>
<tr class="row-6">
	<td class="column-1">Video Decoding</td><td class="column-2">H.264, H.265 HEVC (8/10bit), VP8, VP9, VC-1, AVC, JPEG</td><td class="column-3">H.264, H.265 HEVC (8/10bit), VP8, VP9, VC-1, AVC, JPEG</td>
</tr>
<tr class="row-7">
	<td class="column-1">Video Encoding</td><td class="column-2">H.264, JPEG</td><td class="column-3">H.264, H.265 HEVC (8/10bit), VP8, VP9, VC-1, AVC, JPEG</td>
</tr>
<tr class="row-8">
	<td class="column-1">GPU FP16/FP32/FP64</td><td class="column-2">64 / 32 / 8 GFLOPS</td><td class="column-3">? / 610 / ? GFLOPS</td>
</tr>
<tr class="row-9">
	<td class="column-1">Video Out</td><td class="column-2">2x micro HDMI + MIPI DSI</td><td class="column-3">2x HDMI + MIPI DSI</td>
</tr>
<tr class="row-10">
	<td class="column-1">Video In</td><td class="column-2">MIPI CSI</td><td class="column-3">1x micro HDMI + MIPI CSI</td>
</tr>
<tr class="row-11">
	<td class="column-1">Storage</td><td class="column-2">MicroSD<br />
USB 3.0 attached storage is supported</td><td class="column-3">PCIe 3.0 x4 M.2 M-key (up to 2280)<br />
MicroSD<br />
eMMC socket (<a href="https://wiki.radxa.com/Rock5/hardware/emmc" rel="noopener" target="_blank">ODroid compatible</a>)<br />
16MB SPI flash bootloader</td>
</tr>
<tr class="row-12">
	<td class="column-1">USB</td><td class="column-2">2x USB 2.0 Type-A<br />
2x USB 3.0 Type-A</td><td class="column-3">2x USB 2.0 Type-A<br />
2x USB 3.0 Type-A</td>
</tr>
<tr class="row-13">
	<td class="column-1">PCIe</td><td class="column-2">N/A<br />
</td><td class="column-3">PCIe 3.0 x4 M.2 M key (up to 2280 SSD for storage)<br />
PCIe 2.0 M.2 E key (for WiFi/Bluetooth module)<br />
</td>
</tr>
<tr class="row-14">
	<td class="column-1">Networking</td><td class="column-2">1Gbps Broadcom (BCM54213PE)<br />
802.11ac 2.4/5Ghz (Infineon CYW43455)</td><td class="column-3">2.5Gbps RTL8125 NIC<br />
No builtin wireless (<a href="https://wiki.radxa.com/Rock5/hardware/wifi" rel="noopener" target="_blank">requires PCIe M.2 E key module</a>)</td>
</tr>
<tr class="row-15">
	<td class="column-1">Bluetooth</td><td class="column-2">Bluetooth 5.0, BLE (BCM54213PE)<br />
</td><td class="column-3">No builtin wireless (<a href="https://wiki.radxa.com/Rock5/hardware/wifi" rel="noopener" target="_blank">requires PCIe M.2 E key module</a>)</td>
</tr>
<tr class="row-16">
	<td class="column-1">I2C</td><td class="column-2">up to 6x</td><td class="column-3">up to 5x</td>
</tr>
<tr class="row-17">
	<td class="column-1">SPI</td><td class="column-2">up to 6x (however some SPI pins overlap with other SPI devices so all can&#8217;t be used at once)</td><td class="column-3">up to 3x</td>
</tr>
<tr class="row-18">
	<td class="column-1">UART</td><td class="column-2">up to 6x UART</td><td class="column-3">up to 4x (<a href="https://wiki.radxa.com/Rock5/hardware/5b/gpio" rel="noopener" target="_blank">5x listed on GPIO pinout</a>, uart1 on pinout doesn&#8217;t have an overlay file.  There are 2 additional overlay files that don&#8217;t match to pins on the GPIO header &#8211; uart 6 and 8)</td>
</tr>
<tr class="row-19">
	<td class="column-1">PWM</td><td class="column-2">up to 4x (2 PWM controllers with 2 outputs each)</td><td class="column-3">up to 10x (<a href="https://wiki.radxa.com/Rock5/hardware/5b/gpio" rel="noopener" target="_blank">10x listed on GPIO pinout</a>, 4 additional overlay files that don&#8217;t match to pins on the GPIO header)</td>
</tr>
<tr class="row-20">
	<td class="column-1">ADC (analog to digital)</td><td class="column-2">N/A</td><td class="column-3">1x (could not find an overlay or any documentation for it yet)</td>
</tr>
<tr class="row-21">
	<td class="column-1">CAN Bus</td><td class="column-2">N/A</td><td class="column-3">1x (listed on GPIO pinout but no builtin overlay and driver isn&#8217;t compiled in the default kernel)</td>
</tr>
<tr class="row-22">
	<td class="column-1">General GPIO / Other</td><td class="column-2">up to 28x</td><td class="column-3">up to 26x</td>
</tr>
<tr class="row-23">
	<td class="column-1">Power</td><td class="column-2">5v DC with USB-C plug 3A<br />
5v DC on pins 2&amp;4 3A</td><td class="column-3">USB PD 2.0 12/15/20v with 2amp or higher<br />
9-20v DC power with USB-C plug<br />
5v PoE power on pins 2&amp;4</td>
</tr>
<tr class="row-24">
	<td class="column-1">Kernel Support</td><td class="column-2">6.1 (<a href="https://github.com/raspberrypi/linux" rel="noopener" target="_blank">RPI fork</a>, updates are pushed back to mainline)</td><td class="column-3">5.10 (<a href="https://github.com/radxa/kernel" rel="noopener" target="_blank">Radxa fork</a>, <a href="https://gitlab.collabora.com/hardware-enablement/rockchip-3588/notes-for-rockchip-3588/-/blob/main/mainline-status.md" rel="noopener" target="_blank">RK3588 mainline integration status</a>)</td>
</tr>
<tr class="row-25">
	<td class="column-1">Purchase Links</td><td class="column-2"><a href="https://amzn.to/3PlH0w9" target="_blank" rel="noopener">Amazon (1/2/4GB models)</a><br />
<a href="https://amzn.to/43IQJB4" target="_blank" rel="noopener">Amazon (8GB model)<a/></td><td class="column-3"><a href="https://amzn.to/46a49Yy" target="_blank" rel="noopener">Amazon (8GB model)</a><br />
<a href="https://www.okdo.com/us/p/okdo-rock-5-model-b-8gb-single-board-computer-rockchip-rk3588-arm-cortex-a76-cortex-a55/?utm_source=google&amp;utm_medium=surfaces&amp;utm_campaign=usafeed_shopping&amp;utm_content=surfaces_across_google&amp;gad=1&amp;gclid=CjwKCAjw-b-kBhB-EiwA4fvKrAGH2b9-MV_nTBrrw1tVYKqw1g_XKtoWi8_b5k_L1U5l5jaBvwhmLhoCSM0QAvD_BwE&amp;gclsrc=aw.ds" target="_blank" rel="noopener">OKDO (8GB model)</a></td>
</tr>
</tbody>
</table>



<p>The Raspberry Pi 4B in particular was impressive when it came out in 2019 the power boost over the Pi 3B was massive.&nbsp; I still found though that using the GUI with anything more than bare basics was way to slow for it to operate as a desktop replacement.&nbsp; The Rock 5B by comparison has become my defacto desktop for everything except for some apps that are Windows specific or that just aren’t available on Linux ARM yet.&nbsp; You can read about the software setup I have running <a href="https://www.learningtopi.com/uncategorized/radxa-rock-5b-software/">here</a> (includes Chromium with Chrome sync, XRDP for remote access, SSSD for AD Authentication, Blender and Cura for 3D Printing).</p>



<h2 class="wp-block-heading">Hardware Setup</h2>



<p>In order to keep the document a resonable length, I broke out the hardware configuration for both the Raspberry Pi 4B and Radxa Rock 5B into separate documents.  The Pi 4B setup was straightforward and only required some edits in the /boot/config.txt file.  The Rock 5B on the other hand required a kernel recompile (in order to add the IR drivers) and new overlay files.  I documented the process for both:</p>



<p><a href="https://www.learningtopi.com/sbc/raspberry-pi/raspberry-pi-4b-sbc_gpio/" target="_blank" rel="noreferrer noopener">Raspberry Pi 4B sbc_gpio hardware setup</a></p>



<p><a href="https://www.learningtopi.com/sbc/radxa-rock-5b-setup-for-sbc_gpio/" target="_blank" rel="noreferrer noopener">Radxa Rock 5B sbc_gpio hardware setup</a></p>



<h2 class="wp-block-heading">Results</h2>



<p>I figured I would start with the results, then walk back through the setup and differences.&nbsp; I executed an hour long run of my sbc_gpio test using threading to run all tests simultaneously (FYI I also tested with async and didn’t see any appreciable differences).&nbsp;</p>



<table id="tablepress-7" class="tablepress tablepress-id-7">
<thead>
<tr class="row-1">
	<td class="column-1"></td><th class="column-2">Pi 4B (RPi.GPIO)</th><th class="column-3">Pi 4B (gpiod)</th><th class="column-4">Rock 5B (gpiod)</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">LED</td><td class="column-2">OK</td><td class="column-3">OK</td><td class="column-4">OK</td>
</tr>
<tr class="row-3">
	<td class="column-1">Button</td><td class="column-2">OK</td><td class="column-3">OK</td><td class="column-4">OK</td>
</tr>
<tr class="row-4">
	<td class="column-1">I2C Display</td><td class="column-2">3188 / 3188 &#8211; 100%</td><td class="column-3">3163 / 3163 – 100%</td><td class="column-4">3218 / 3218 – 100%</td>
</tr>
<tr class="row-5">
	<td class="column-1">BMP/BME280 SPI</td><td class="column-2">3253 / 3253 &#8211; 100%</td><td class="column-3">3255 / 3255 – 100%</td><td class="column-4">3247 / 3247 – 100%</td>
</tr>
<tr class="row-6">
	<td class="column-1">DHT11/22 (over SPI)</td><td class="column-2">1676 / 1701 &#8211; 99%</td><td class="column-3">1662 / 1698 – 98%</td><td class="column-4">1605 / 1685 – 95%</td>
</tr>
<tr class="row-7">
	<td class="column-1">IR Tx/Rx</td><td class="column-2">1609 / 2545 &#8211; 63%</td><td class="column-3">1376 / 2544 – 54%</td><td class="column-4">2540 / 2540 – 100%</td>
</tr>
<tr class="row-8">
	<td class="column-1">UART <-> CP2102</td><td class="column-2">13155 / 14266 &#8211; 92%</td><td class="column-3">12663 / 13992 – 91%</td><td class="column-4">15148 / 15150 – 99.99%</td>
</tr>
</tbody>
</table>
<!-- #tablepress-7 from cache -->


<p>The results here were a bit startling. I expected the Pi4B to take everything I threw at it and not miss a beat. The DHT11 over SPI (which you can read more about <a href="https://www.learningtopi.com/sbc/python_dht11_spi/">here</a>) I expected some failures. My SPI library is still <strong>vastly </strong>better than the old bit banging DHT11 library, but it isn&#8217;t perfect. </p>



<p>The infrared failures surprised me. I ran multiple tests and had varying results, but in general rarely saw much higher than the 54% above.  Not sure what is causing IR to perform so poorly.  I am using the same IR LED and IR receiver as I did on the Rock 5B, and both use the <code>gpio-ir-tx</code> and <code>gpio-ir-recv </code>kernel drivers.  I&#8217;ll need to do some further tests to determine if it is a send or receive problem.</p>



<p>I was also shocked at the UART results. I didn’t expect as many failures as I saw.  While it was only about 9%, this was a lot higher than I expected for basic serial communication.  For my test the UART connects directly to a CP2102 USB to serial adapter that connects back to the SBC.&nbsp; I iterate through a range of baud rates (9600, 115200, 230400, 460800, 576000 and 921600) and data sizes (64, 128, 256, 512, 1024 and 2048) and track the results.&nbsp; I also track the send from the UART port (and received on USB) separately from the reverse.  Here is a breakdown of the UART results on the Pi 4B.</p>



<h3 class="wp-block-heading">Pi4B UART Breakdown &#8211; Transmission Size</h3>



<table id="tablepress-8" class="tablepress tablepress-id-8">
<thead>
<tr class="row-1">
	<th class="column-1">Size (bytes)</th><th class="column-2">UART -> USB CP2102</th><th class="column-3">USB CP2102 -> UART</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">64</td><td class="column-2">1166 / 1166 – 100%</td><td class="column-3">1123 / 1166 – 96.3%</td>
</tr>
<tr class="row-3">
	<td class="column-1">128</td><td class="column-2">1166 / 1166 – 100%</td><td class="column-3">903 / 1166 – 77.4%</td>
</tr>
<tr class="row-4">
	<td class="column-1">256</td><td class="column-2">1081 / 1166 – 92.7%</td><td class="column-3">1055 / 1166 – 90.5%</td>
</tr>
<tr class="row-5">
	<td class="column-1">512</td><td class="column-2">1081 / 1166 – 92.7%</td><td class="column-3">988 / 1166 – 84.7%</td>
</tr>
<tr class="row-6">
	<td class="column-1">1024</td><td class="column-2">1166 / 1166 – 100%</td><td class="column-3">953 / 1166 – 81.7%</td>
</tr>
<tr class="row-7">
	<td class="column-1">2048</td><td class="column-2">1166 / 1166 – 100%</td><td class="column-3">815 / 1166 – 69.9%</td>
</tr>
</tbody>
<tfoot>
<tr class="row-8">
	<th class="column-1">TOTAL</th><th class="column-2">6826 / 6996 – 97.6%</th><th class="column-3">5837 / 6996 – 83.4%</th>
</tr>
</tfoot>
</table>
<!-- #tablepress-8 from cache -->


<p>Looking at the breakdown we see that there is a BIG difference depending on which side is sending vs receiving.&nbsp; I haven’t been able to determine if the issue is on the USB sending side, or the UART receiving side yet, but there is a very definitive issue and from the spread across data sizes it doesn’t appear to be directly related to the size (although we do see a drop in success rates as we move from 256 to 2048 bytes).</p>



<table id="tablepress-9" class="tablepress tablepress-id-9">
<thead>
<tr class="row-1">
	<th class="column-1">Baudrate</th><th class="column-2">UART -> USB</th><th class="column-3">USB -> UART</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">9600</td><td class="column-2">1000 / 1170 – 85.5%</td><td class="column-3">635 / 1170 – 54.3%</td>
</tr>
<tr class="row-3">
	<td class="column-1">115200</td><td class="column-2">1170 / 1170 – 100%</td><td class="column-3">910 / 1170 – 77.8%</td>
</tr>
<tr class="row-4">
	<td class="column-1">230400</td><td class="column-2">1164 / 1164 – 100%</td><td class="column-3">1033 / 1164 – 88.7%</td>
</tr>
<tr class="row-5">
	<td class="column-1">460800</td><td class="column-2">1164 / 1164 – 100%</td><td class="column-3">1043 / 1164 – 89.6%</td>
</tr>
<tr class="row-6">
	<td class="column-1">576000</td><td class="column-2">1164 / 1164 – 100%</td><td class="column-3">1132 / 1164 – 97.3%</td>
</tr>
<tr class="row-7">
	<td class="column-1">921600</td><td class="column-2">1164 / 1164 – 100%</td><td class="column-3">1084 / 1164 – 93.1%</td>
</tr>
</tbody>
<tfoot>
<tr class="row-8">
	<th class="column-1">TOTAL</th><th class="column-2">6826 / 6996 – 97.6%</th><th class="column-3">5837 / 6996 – 83.4%</th>
</tr>
</tfoot>
</table>
<!-- #tablepress-9 from cache -->


<p>When we look at the data grouped by baud, we see some interesting results.&nbsp; ALL the drops from UART to USB happened at 9600 which seems counterintuitive.&nbsp; This leads me to believe there may be a buffering issue.&nbsp; The lower data rate requires the UART driver / hardware to hold data for a longer period of time while the bits are transmitted.&nbsp; We see a similar pattern from USB to UART.&nbsp; As the data rate moves up from 9600 to 57600 we see the success rate IMPROVE.&nbsp; At 921600 we see a slight drop off.&nbsp; This again makes me think buffering issues. &nbsp;Lower data rates that take longer to finish a transmission have a higher failure rate.</p>



<p>Looking at all this makes me lean toward an issue on the UART side sending at low data rates as well as receiving at low data rates.&nbsp; I used the same CP2102 on the Rock 5B and saw no issues so I wouldn’t expect that this is the issue.&nbsp; I’ll keep digging for more details and post and update if I find anything, but for now I’m going to say this is most likely due to a difference between how the Broadcom BCM2711 and Rockchip RK35688 handle the UART.</p>



<h2 class="wp-block-heading">Setting up the SBC&#8217;s</h2>



<p>Due to the length it takes to run through the setup, I&#8217;ll break these out into separate posts for each board.  </p>



<p>As a summary though, configuring the Pi 4B was a breeze.  The <code>raspi-config</code> tool can be used to configure the I2C, 1st SPI and UART.  For the 2nd SPI, IR Tx and IR Rx, the configuration needs to be done in the <code>/boot/config.txt </code>file directly.  After adding the relevant overlay config all that is required is to save and reboot.  The Raspberry Pi even provides a mechanism for dynamically applying overlays without rebooting!  (I haven&#8217;t tested this, but documentation is available <a href="https://www.raspberrypi.com/documentation/computers/configuration.html#part3.5" target="_blank" rel="noreferrer noopener">here</a>)</p>



<p>The Rock 5B is considerably more difficult.  There is no equivalent to the <code>raspi-config </code>tool, so edits need to be made to the <code>/boot/config.txt </code>file directly.  Adding the I2C, both SPI and UART overlays is straightfoward, however there is a problem with the IR.  The stock kernel from Radxa didn&#8217;t include the necessary kernel drivers, so we had to recompile the kernel to include them.  I addition there are no overlay files for IR so those need to be created as well.  I walk through the process in my setup guide for the Rock 5B, however this is a far more complicated process than the Pi 4B.</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Setting up the Rock 5B can be a bit of a headache if you need an overlay that isn&#8217;t included by default, and the Rock 5B doesn&#8217;t have an overlay available for IR, CAN or ADC.  If you plan to use anything beyond I2C, SPI, UART or general GPIO expect the Rock 5B to be more complex to setup and use.  That being said the results speak for themselves.  If the Pi 4B is the gold standard, the Rock 5B has the potential to take the crown!  All we need is some improvements in compiled drivers and overlays to call the Rock 5B the new gold standard!</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>NOTE:  I&#8217;ve seen many articules reviewing the Rock 5B call out the lack of builtin wireless as the reason the Rock 5B isn&#8217;t ready to take over the crown.  Personally I disagree with that assessment.  Radxa provides a PCIe M-key slot that can be used with multiple different wireless cards (see supported lists <a href="https://wiki.radxa.com/Rock5/hardware/wifi" target="_blank" rel="noreferrer noopener">here</a>).  Adding a wifi card does add a bit to the price but allows for more options and an upgrade path down the road.</p>
</blockquote>
<p>The post <a href="https://www.learningtopi.com/sbc/sbc_gpio-pi-4b-vs-rock-5b/">sbc_gpio: Pi 4B vs Rock 5B</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/sbc_gpio-pi-4b-vs-rock-5b/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Radxa Rock 5B Setup for sbc_gpio</title>
		<link>https://www.learningtopi.com/sbc/radxa-rock-5b-setup-for-sbc_gpio/</link>
					<comments>https://www.learningtopi.com/sbc/radxa-rock-5b-setup-for-sbc_gpio/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Tue, 20 Jun 2023 05:36:02 +0000</pubDate>
				<category><![CDATA[Rock5B]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[kernel compile]]></category>
		<category><![CDATA[overlays]]></category>
		<category><![CDATA[python sbc_gpio]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=1052</guid>

					<description><![CDATA[<p>If you are looking for the results of the&#160;sbc_gpio&#160;tests, please check out our sbc_gpio Pi 4B vs Rock 5B comparison. Configuring the Radxa Rock 5B for our&#160;sbc_gpio&#160;test require 1x I2C, 2x SPI, 1x UART and 2x IR (1 Tx and 1 Rx). All the configuration will need to be done directly in the /boot/config.txt file....</p>
<p>The post <a href="https://www.learningtopi.com/sbc/radxa-rock-5b-setup-for-sbc_gpio/">Radxa Rock 5B Setup for sbc_gpio</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"><div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/500px-Rock5b-v142-angel.jpg" alt="" class="wp-image-468" width="353" height="296" srcset="https://www.learningtopi.com/wp-content/uploads/500px-Rock5b-v142-angel.jpg 500w, https://www.learningtopi.com/wp-content/uploads/500px-Rock5b-v142-angel-300x252.jpg 300w, https://www.learningtopi.com/wp-content/uploads/500px-Rock5b-v142-angel-150x126.jpg 150w" sizes="auto, (max-width: 353px) 100vw, 353px" /></figure>
</div></div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="300" height="280" src="https://www.learningtopi.com/wp-content/uploads/300px-Start_5b.png" alt="" class="wp-image-467" srcset="https://www.learningtopi.com/wp-content/uploads/300px-Start_5b.png 300w, https://www.learningtopi.com/wp-content/uploads/300px-Start_5b-150x140.png 150w" sizes="auto, (max-width: 300px) 100vw, 300px" /></figure>
</div>
</div>



<p>If you are looking for the results of the&nbsp;<code>sbc_gpio&nbsp;</code>tests, please check out our <a href="https://www.learningtopi.com/sbc/sbc_gpio-pi-4b-vs-rock-5b/">sbc_gpio Pi 4B vs Rock 5B</a> comparison.</p>



<p>Configuring the Radxa Rock 5B for our&nbsp;<code>sbc_gpio&nbsp;</code>test require 1x I2C, 2x SPI, 1x UART and 2x IR (1 Tx and 1 Rx). All the configuration will need to be done directly in the <code>/boot/config.txt</code> file.  Radxa does not have a tool similar to<code> raspi-config</code> on the Raspberry Pi.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>For reference the IR receiver we are using is a TSOP38238&nbsp;receiver diode.  You can find them here:  <a href="https://amzn.to/3PjZm0x" target="_blank" rel="noreferrer noopener">https://amzn.to/3PjZm0x</a>.  We are also using IR LED&#8217;s that you can find here: <a href="https://amzn.to/3XdDlCw" target="_blank" rel="noreferrer noopener">https://amzn.to/3XdDlCw</a></p>
<cite>We are an Amazon affiliate and may receive some compensation from any products purchased.  Affiliations and ads are how we can provide the content that we do!</cite></blockquote>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>NOTE:  After any changes to the <code>/boot/config.txt </code>file, you MUST run <code>"sudo update_extlinux.sh"</code> to update the<code> /boot/extlinux/extlinux.conf</code> file.  If you don&#8217;t run the <code>update_extlinux.sh</code> script the changes to the <code>/boot/config.txt</code> file won&#8217;t ever be applied.</p>
</blockquote>



<h2 class="wp-block-heading">I2C, SPI and UART Overlays</h2>



<p>The I2C, SPI and UART overlays are easily configured using the /boot/config.txt file.  The following lines will add overlays for I2C7, SPI0, SPI1 and UART2:</p>



<pre class="wp-block-code"><code>dtoverlay=rk3588-i2c7-m3
dtoverlay=rk3588-spi0-m2-cs0-spidev
dtoverlay=rk3588-spi1-m1-cs0-spidev
dtoverlay=rk3588-urat2-m0</code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>NOTE:  After any changes to the <code>/boot/config.txt </code>file, you MUST run <code>"sudo update_extlinux.sh"</code> to update the<code> /boot/extlinux/extlinux.conf</code> file.  If you don&#8217;t run the <code>update_extlinux.sh</code> script the changes to the <code>/boot/config.txt</code> file won&#8217;t ever be applied.</p>
</blockquote>



<p>This gets everything except the infrared quickly and easily.  Of course IR is where we run into an issue&#8230;</p>



<h2 class="wp-block-heading">Infrared Transmit and Receive</h2>



<p>There are two issues with setting up IR on the Rock 5B:</p>



<ol class="wp-block-list">
<li>The stock Radxa kernel (5.10.110) does not have any IR Tx or Rx modules compiled in it</li>



<li>There is no overlay for IR Tx or Rx compiled and available</li>
</ol>



<p>Before we can run an infrared tests, we will need to fix both of these issues.</p>



<h3 class="wp-block-heading">Compile the kernel with IR modules</h3>



<p>First step is we need to recompile the kernel.  Radxa has decent instructions available on their website:  <a href="https://wiki.radxa.com/Rock5/guide/build-kernel-on-5b" target="_blank" rel="noreferrer noopener">https://wiki.radxa.com/Rock5/guide/build-kernel-on-5b</a></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>I put in a merge request to the Radxa kernel to enable IR modules in future kernel builds (<a href="https://github.com/radxa/kernel/pull/128" target="_blank" rel="noreferrer noopener">https://github.com/radxa/kernel/pull/128</a>).  Before you recompile the kernel, check to see if the module is included for the Tx and Rx bit-banging driver.  Run the following commands:</p>



<p>sudo modinfo gpio-ir-tx</p>



<p>sudo modinfo gpio-ir-recv</p>
</blockquote>



<p>The Radxa kernel build instructions from the guide above assumes that you are compiling on the Rock 5B itself.  It you are intending to compile on a different system, there are more steps that need to be performed to setup cross platform compilation.</p>



<p>Here is a summary of the steps (from the <a href="https://wiki.radxa.com/Rock5/guide/build-kernel-on-5b" target="_blank" rel="noreferrer noopener">Radxa guide</a>):</p>



<h4 class="wp-block-heading">Install Prerequisites</h4>



<pre class="wp-block-code"><code>sudo apt-get update
 &amp;&amp; sudo apt-get install -y git  device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools bc python dosfstools bison flex rsync u-boot-tools make</code></pre>



<h4 class="wp-block-heading">Clone the Source Code</h4>



<pre class="wp-block-code"><code>mkdir ~/rk3588-sdk &amp;&amp; cd ~/rk3588-sdk
git clone -b linux-5.10-gen-rkr3.4 https://github.com/radxa/kernel.git
git clone -b master https://github.com/radxa/rkbin.git
git clone -b debian https://github.com/radxa/build.git</code></pre>



<p>You can of course clone to a different folder.  The examples from Radxa will assume that all the code is in the <code>~/rk3588-sdk</code> folder.</p>



<h4 class="wp-block-heading">Update the Kernel Config</h4>



<p>The next step is to update the kernel config to include the IR modules.</p>



<pre class="wp-block-preformatted">cd ~/rk3588-sdk/kernel
make rockchip_linux_defconfig
make menuconfig</pre>



<p>This will load the text menu configuration utility for the kernel.  On the main menu scroll down to the &#8220;Device Drivers&#8221; section and hit ENTER to select it (the &#8212;&gt; at the end of the line indicates that there is a submenu).</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="799" height="460" src="https://www.learningtopi.com/wp-content/uploads/kernel-compile-drivers.png" alt="" class="wp-image-1089" srcset="https://www.learningtopi.com/wp-content/uploads/kernel-compile-drivers.png 799w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-drivers-300x173.png 300w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-drivers-150x86.png 150w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-drivers-768x442.png 768w" sizes="auto, (max-width: 799px) 100vw, 799px" /></figure>



<p>On the Device Drivers page, scroll down until you reach &#8220;Remote Controller support&#8221;.  The left column should show a &#8220;[ ]&#8221; which signifies that it is not currently included in the kernel.  Hit &#8220;M&#8221; or SPACE until it changes to a &#8220;&lt;M&gt;&#8221;.  Then hit ENTER to enter the &#8220;Remote Controller Support&#8221; sub-menu.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="796" height="509" src="https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-support.png" alt="" class="wp-image-1092" srcset="https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-support.png 796w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-support-300x192.png 300w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-support-150x96.png 150w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-support-768x491.png 768w" sizes="auto, (max-width: 796px) 100vw, 796px" /></figure>



<p>Here we need to enable the &#8220;LIRC user interface&#8221; by hitting the SPACEBAR.  After this is set to &#8220;[*]&#8221;, move down to the &#8220;Remote Controller Decoders&#8221; and hit SPACE again.  When the 1st column changes to &#8220;[*]&#8221;  the submenu for the decoders will be activated.  Just select them all by using the SPACE or &#8220;M&#8221; key.  Use the right arrow key to select &#8220;EXIT&#8221; from the list of options at the bottom to go back up a menu.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="800" height="456" src="https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-sub.png" alt="" class="wp-image-1091" srcset="https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-sub.png 800w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-sub-300x171.png 300w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-sub-150x86.png 150w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-sub-768x438.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></figure>



<p>Select &#8220;Remote Controller Devices&#8221; and hit SPACE.  Once the 1st column changes to &#8220;[*]&#8221; hit enter to enter the menu.  From here select at a minimum the &#8220;GPIO IR remote control&#8221; and &#8220;GPIO IR Bit Banging Transmitter&#8221;.  I additionally added the &#8220;SPI connected IR LED&#8221; and &#8220;PWM IR transmitter&#8221; for future use.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="797" height="455" src="https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-drivers.png" alt="" class="wp-image-1090" srcset="https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-drivers.png 797w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-drivers-300x171.png 300w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-drivers-150x86.png 150w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-rc-drivers-768x438.png 768w" sizes="auto, (max-width: 797px) 100vw, 797px" /></figure>



<p>Once the updates have been made, use the right arrow to move over to &#8220;Save&#8221; on the bottom list, and save the config as &#8220;.config&#8221; (this is the default config file).</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="799" height="453" src="https://www.learningtopi.com/wp-content/uploads/kernel-compile-save.png" alt="" class="wp-image-1093" srcset="https://www.learningtopi.com/wp-content/uploads/kernel-compile-save.png 799w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-save-300x170.png 300w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-save-150x85.png 150w, https://www.learningtopi.com/wp-content/uploads/kernel-compile-save-768x435.png 768w" sizes="auto, (max-width: 799px) 100vw, 799px" /></figure>



<h4 class="wp-block-heading">Compile the Kernel and Install It</h4>



<p>After you save, exit out of all the menus until you are back at the command line.  Next run the following commands to prep the new configuration for the kernel build.</p>



<pre class="wp-block-code"><code>make savedefconfig
cp defconfig arch/arm64/configs/rockchip_linux_defconfig</code></pre>



<p>Next (but not last), we need to build the kernel.  This will take some time to complete:</p>



<pre class="wp-block-code"><code>cd ~/rk3588-sdk
./build/mk-kernel.sh rk3588-rock-5b</code></pre>



<p>After you finish the kernel build, verify that the files are present:</p>



<pre class="wp-block-preformatted">$ ls out/kernel/
Image  rk3588-rock-5b.dtb</pre>



<p>The last step is to convert your new kernel image into a &#8220;deb&#8221; package that you can install in Debian, Ubuntu, or any other Debian based system that you are running.  You will need to add a release number that will be appended to the kernel.  This will append a value after 5.10.110-&#8221; in the filename.  For differentiation, the lastest build I have from Radxa&#8217;s APT repo is 37.  I typically start at 1000 to make it easy to identify.</p>



<pre class="wp-block-preformatted">./build/pack-kernel.sh -d rockchip_linux_defconfig -r 1000</pre>



<p>Once the pack-kernel script is complete, you will now have a series of packages ready to be installed:</p>



<pre class="wp-block-preformatted">$ ls out/packages/
linux-5.10.110-99-rockchip-g9fd61a9a9912_5.10.110-1000-rockchip_arm64.changes
linux-headers-5.10.110-99-rockchip-g9fd61a9a9912_5.10.110-1000-rockchip_arm64.deb
linux-image-5.10.110-99-rockchip-g9fd61a9a9912-dbg_5.10.110-1000-rockchip_arm64.deb
linux-image-5.10.110-99-rockchip-g9fd61a9a9912_5.10.110-1000-rockchip_arm64.deb
linux-libc-dev_5.10.110-1000-rockchip_arm64.deb</pre>



<p>You will need to install the &#8220;image&#8221; and &#8220;headers&#8221; package.  There are two packages named &#8220;linux-image&#8221;, you will only need the one that DOES NOT include the &#8220;-dbg&#8221; text.  This copy of the kernel includes debugging components that I&#8217;m sure you won&#8217;t require if you are reading this post!  Just install the images using &#8220;dpkg&#8221;:</p>



<pre class="wp-block-code"><code>sudo dpkg -i out/packages/linux-image-5.10.110-99-rockchip-g9fd61a9a9912_5.10.110-1000-rockchip_arm64.deb
sudo dpkg -i out/packages/linux-headers-5.10.110-99-rockchip-g9fd61a9a9912_5.10.110-1000-rockchip_arm64.deb</code></pre>



<h4 class="wp-block-heading">Check Your Kernel</h4>



<p>If you check the <code>/boot/extlinux/extlinux.conf</code> file, you should see your new kernel build listed as the first image.  Reboot and verify with <code>uname -a</code>!  If you see your specific kernel build number then you are done and ready to move on to overlays!</p>



<h3 class="wp-block-heading">Create the Overlays</h3>



<p>First off, what is an overlay?  For reference we are in fact refering to a Device Tree Overlay.  A device tree overlay can performs two functions for us: </p>



<p>1st &#8211; The overlay is read during the boot process and is used to enable parts of the hardware that are not enabled by default.  An example here is enabling the UART, SPI or I2C devices that we did previously.  These use the same pins as regular GPIO&#8217;s and the hardware has to be told to enable the UART functions in the hardware chip.</p>



<p>2nd &#8211; The overlay associates a kernel driver with a hardware device.  For the case of infrared, we need to tell the kernel what GPIO pin we want, how to configure that pin (i.e. pull up or down) and associate it with a driver.</p>



<h4 class="wp-block-heading">Overlay Caveats to keep in mind</h4>



<p>In order to run our IR tests, we will need to create 2 overlays, one for the transmit LED, and one for the receiver, but first a few notes:</p>



<ul class="wp-block-list">
<li>The overlay is in a DTS file, but all DTS files must be compiled to DTB or DTBO files for use during the boot process.  (Think of this like a C file that needs to be compiled to a binary.)</li>



<li>The compiled DTBO file needs to be accessible VERY early in the boot process, so they must all be located in the <code>/boot</code> dir.</li>



<li>There are different mechanisms used by different vendors to load DTBO overlay files.  The Rock 5B uses uboot and extlinux to apply device tree overlays and start the Linux kernel.  With Raspberry Pi OS, the config.txt file is loaded and parsed to get overlay parameters (i.e. which GPIO to use).  Uboot does not allow this, so this means we need to create a compiled DTBO file with the exact parameters (including GPIO pin).</li>



<li>Radxa&#8217;s <code>update_extlinush.sh</code> file (remember you have to run this after <code>/boot/config.tx</code>t changes) wipes and reloads the DTBO overlay files in the <code>/boot/dtbs directory</code>.</li>
</ul>



<h4 class="wp-block-heading">IR Rx Overlay</h4>



<p>The IR Rx overlay will need to use the <code>gpio-ir-</code>recv driver we compiled into the kernel previously.  We will also need to assign the GPIO pin we want to use.  For our example we will be using pin 3A3 (gpio chip 3, pin 11).  The TSOP38238&nbsp;IR sensor is active low (as opposed to high), so we also need to let the kernel know this.</p>



<p>Here is the DTS file contents.  We will need to save this file somewhere (doesn&#8217;t need to be on the boot partition) so we can compile it into a DTBO.  For reference, we will use the name <code>rk3588-ir-rx.dts</code> for consistency with the other rk3588 overlays.</p>



<pre class="wp-block-code"><code>// Definitions for ir-gpio-recv module
/dts-v1/;
/plugin/;

#include "dt-bindings/gpio/gpio.h"

/ {

        fragment@0 {
                target-path = "/";
                __overlay__ {
                        gpio_ir_recv: gpio_ir_recv {
                                compatible = "gpio-ir-receiver";
                                status = "okay";
                                gpios = &lt;&amp;gpio3 11 GPIO_ACTIVE_LOW&gt;;
                                pinctrl-names = "default";
                        };
                };
        };
};</code></pre>



<p>Once we have the DTS file defined, we can compile it to a DTBO:</p>



<pre class="wp-block-code"><code>dtc -i dts -O dtb rk3588-ir-rx.dts rk3588-ir-rx.dtbo</code></pre>



<h4 class="wp-block-heading">IR Tx Overlay</h4>



<p>The IR Tx overlay will need to use the <code>gpio-ir-tx</code> driver we compiled into the kernel previously.  We will also need to assign the GPIO pin we want to use.  For our example we will be using pin 3A2 (gpio chip 3, pin 10).</p>



<p>Here is the DTS file contents.  We will need to save this file somewhere (doesn&#8217;t need to be on the boot partition) so we can compile it into a DTBO.  For reference, we will use the name <code>rk3588-ir-tx.dts</code> for consistency with the other rk3588 overlays.</p>



<pre class="wp-block-code"><code>// Definitions for ir-gpio-tx module
/dts-v1/;
/plugin/;

/ {

        fragment@0 {
                target-path = "/";
                __overlay__ {
                        gpio_ir_tx {
                                compatible = "gpio-ir-tx";
                                status = "okay";
                                gpios = &lt;&amp;gpio3 10 0&gt;;
                                pinctrl-names = "default";
                        };
                };
        };
};</code></pre>



<p>Once we have the DTS file defined, we can compile it to a DTBO:</p>



<pre class="wp-block-code"><code>dtc -i dts -O dtb rk3588-ir-tx.dts rk3588-ir-tx.dtbo</code></pre>



<h4 class="wp-block-heading">Applying your Overlay at Boot</h4>



<p>Now that we have our DTBO files, we need to configure the system to load them on boot.  The <code>update_extlinux.sh</code> script clears all files in the <code>/boot/dtbs</code> folder and reloads from <code>/usr/lib/linux-image-***</code> so we can&#8217;t put the files here.  We will create a new folder for our DTBO files.</p>



<pre class="wp-block-code"><code>sudo mkdir /boot/custom_dtbs
sudo cp rk3588-ir-tx.dtbo /boot/custom_dtbs
sudo cp rk3588-ir-rx.dtbo /boot/custom_dtbs</code></pre>



<p>This will put our DTBO files where the kernel can get them during the initialization process.  The last step is adding theoverlays into the<code> /boot/extlinux/extlinux.conf</code> file.  Here we need to add our overlays to the <code>fdtoverlays </code>line under the kernel.  If the line already exists (like shown here with the uart7 overlay), just add a space and the new overlay.  If there is no <code>fdtoverlay </code>line, add one after the <code>devicetreedir </code>and before the <code>append </code>lines.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>NOTE:  There will likely be multiple kernels listed.  The system will boot the first so technically you only need to add to the <code>fdtoverlay </code>on the first kernel.  For consistency with the<code> update_extlinux.sh</code> script though I add mine to all the kernels.</p>



<p>The path in the extlinux.conf file may appear odd.  At this point only the boot partition is loaded, and it is loaded as the root partition.  So make sure your path is &#8220;/custom_dtbs/&#8230;&#8221; and not &#8220;/boot/custom_dtbs/&#8230;&#8221;.</p>
</blockquote>



<pre class="wp-block-code"><code>label kernel-5.10.110-2002-rockchip-g76d0450ea961
    kernel /vmlinuz-5.10.110-2002-rockchip-g76d0450ea961
    initrd /initrd.img-5.10.110-2002-rockchip-g76d0450ea961
    devicetreedir /dtbs/5.10.110-2002-rockchip-g76d0450ea961
    fdtoverlays  /dtbs/5.10.110-2002-rockchip-g76d0450ea961/rockchip/overlay/rk3588-uart7-m2.dtbo <mark>/custom_dtbs/rk3588-ir-tx.dtbo /custom_dtbs/rk3588-ir-rx.dtbo</mark>
    append   root=UUID=e29639d9-0c16-4501-8e64-50995cc715e5 earlycon=uart8250,mmio32,0xfeb50000 console=ttyFIQ0 console=tty1 consoleblank=0 loglevel=0 panic=10 rootwait rw init=/sbin/init rootfstype=ext4 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1 irqchip.gicv3_pseudo_nmi=0 switolb=1 coherent_pool=2M</code></pre>



<p>That it!  Just reboot to load the overlays.  You can confirm they are loaded by running dmesg | less and searching for &#8220;gpio-ir-&#8221; or &#8220;lirc&#8221;.  (LIRC setup will be reflected in the sbc_gpio test since it is common setup for all systems.)</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>CAUTION!!  We manually edited the /boot/extlinux/extlinux.conf file.  The next time you run the udpate_extlinux.sh script your changes will be lost!  This ALSO includes any kernel update that may be installed as this script is a triggered action.</p>



<p>I am working on some alternative methodsd that can help with this, but it isn&#8217;t ready for prime time yet.</p>
</blockquote>



<h2 class="wp-block-heading">Summary</h2>



<p>What we saw here is that setting up the Rock 5B is easy as long as you are using one of the predefined overlays.  Moving off the defined list of overlays into infrared we had to not only create our own overlay but also recompile the kernel to include the drivers we needed.  I fully expect to run into similar issues with drivers based on how the kernel is configured.  It appears that the decision was to minimize size rather than include the maximum number of modules.</p>



<p>If you came here from our <a href="https://www.learningtopi.com/sbc/sbc_gpio-pi-4b-vs-rock-5b/">sbc_gpio test result page</a>, feel free to jump back over to the results! </p>
<p>The post <a href="https://www.learningtopi.com/sbc/radxa-rock-5b-setup-for-sbc_gpio/">Radxa Rock 5B Setup for sbc_gpio</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/radxa-rock-5b-setup-for-sbc_gpio/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ZRAM for your SBC</title>
		<link>https://www.learningtopi.com/uncategorized/zram-for-your-sbc/</link>
					<comments>https://www.learningtopi.com/uncategorized/zram-for-your-sbc/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Sun, 18 Jun 2023 02:54:55 +0000</pubDate>
				<category><![CDATA[Raspberry Pi SBC]]></category>
		<category><![CDATA[Rock5B]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[zram]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=1073</guid>

					<description><![CDATA[<p>One issue that I have seen crop up multiple times on different SBC&#8217;s is memory and swap. I have seen many SBC&#8217;s out out of the box that come with no swap space enabled. For systems with no GUI running a single task, this rarely turns into an issue. For larger systems running a GUI...</p>
<p>The post <a href="https://www.learningtopi.com/uncategorized/zram-for-your-sbc/">ZRAM for your SBC</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<p>One issue that I have seen crop up multiple times on different SBC&#8217;s is memory and swap.  I have seen many SBC&#8217;s out out of the box that come with no swap space enabled.  For systems with no GUI running a single task, this rarely turns into an issue.  For larger systems running a GUI with desktop applications this can result in performance issues even on something as powerful as a Radxa Rock 5B with 8GB of RAM.  You may need ZRAM for your SBC!</p>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="566" src="https://www.learningtopi.com/wp-content/uploads/RAM-medium-1024x566.jpg" alt="" class="wp-image-1078" srcset="https://www.learningtopi.com/wp-content/uploads/RAM-medium-1024x566.jpg 1024w, https://www.learningtopi.com/wp-content/uploads/RAM-medium-300x166.jpg 300w, https://www.learningtopi.com/wp-content/uploads/RAM-medium-150x83.jpg 150w, https://www.learningtopi.com/wp-content/uploads/RAM-medium-768x424.jpg 768w, https://www.learningtopi.com/wp-content/uploads/RAM-medium-850x470.jpg 850w, https://www.learningtopi.com/wp-content/uploads/RAM-medium.jpg 1254w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>
</div>



<div class="wp-block-ht-block-toc  is-style-outline htoc htoc--position-wide toc-list-style-plain" data-htoc-state="expanded"><span class="htoc__title"><span class="ht_toc_title">Table of Contents</span></span><div class="htoc__itemswrap"><ul class="ht_toc_list"><li class=""><a href="#htoc-why-do-we-need-swap">Why do we need swap?</a></li><li class=""><a href="#htoc-what-is-zram">What is ZRAM?</a></li><li class=""><a href="#htoc-raspberry-pi-os">Raspberry Pi OS</a></li><li class=""><a href="#htoc-ubuntu-23-04">Ubuntu 23.04</a></li><li class=""><a href="#htoc-debian-11-bullseye">Debian 11 (Bullseye)</a></li><li class=""><a href="#htoc-summary">Summary</a></li></ul></div></div>



<h2 class="wp-block-heading" id="htoc-why-do-we-need-swap">Why do we need swap?</h2>



<p>If you browse the web you&#8217;ll find many different answers to this question.  For a system running a single process, you probably don&#8217;t.  Over the years I have deployed several Raspberry Pi Zero&#8217;s, 3B&#8217;s and 4B&#8217;s that have no swap enabled.  These are all headless systems running just the python app that I wrote for that particular deployment.  All of these systems are able to run for an extended period of time (months+) with no issues.</p>



<p>Once we start running graphical OS&#8217;s, desktop applications with web browsers, file browsing, etc the need for swap becomes clear.  The kernel uses free memory as a file buffer which allows faster access for files that are commonly used.  On my Rock 5B you can see how the memory has currently being used:</p>



<pre class="wp-block-code"><code>$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.5Gi       2.7Gi       3.2Gi       133Mi      <mark> 1.8Gi</mark>       4.8Gi
Swap:          2.0Gi          0B       2.0Gi</code></pre>



<p>Here we can see of 3.2GB of free RAM, but 4.8GB of available.  Most of the difference here is due to the file buffer.  We also can see that no data has been swapped at this time, and there is plenty of free memory even with the current buffer.</p>



<p>As we start to run more applications and open more files, the memory utilization will start to shift.  Even though the kernel will free up space from the buffer when needed, without a swap I have run into application hangs long before I ran out of memory.  In other instances during burn in tests I&#8217;ve had the system kill my application since it was considered the memory &#8220;hog&#8221;.</p>



<p>After running a few web browser windows, downloading some files and launching a couple of VSCode consoles, my memory usage now looks like this:</p>



<pre class="wp-block-code"><code>$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.5Gi       3.9Gi        55Mi       190Mi       3.9Gi       3.7Gi
Swap:          2.0Gi        84Mi       1.9Gi
 </code></pre>



<p>Here you can see that the file buffer has shot up to 3.8GB, used RAM to 3.9GB, and free dropped to 55MB.  You can also see some RAM has been swapped (albiet a small amount).</p>



<h2 class="wp-block-heading" id="htoc-what-is-zram">What is ZRAM?</h2>



<p>ZRAM creates a virtual object (in memory) to hold paged data in a compressed format.  While ZRAM does use some of your memory, on systems that have slow disk I/O (i.e. those using SD cards), this allows the system to take less frequently used memory pages and compress them.</p>



<p>In old kernel versions (i.e. 3.15 and earlier) it was required to run a ZRAM object per CPU core.  This was due to the inability for multiple cores to access the same ZRAM device at the same time.  If you search for ZRAM, you&#8217;ll probably find lots of examples of systems configured with both one ZRAM device for the system as well as those with a ZRAM device per CPU core.</p>



<p>Given that it is 2023, we will assume you are running a 5.x or 6.x Linux kernel and will configure with a single ZRAM device for simplicity.  HOWEVER, a lot of the default scripts and tools still assume one device per core, so there may be some adjustments required to ensure proper operations.</p>



<p>You can read more about ZRAM here: <a href="https://www.kernel.org/doc/html/next/admin-guide/blockdev/zram.html" target="_blank" rel="noreferrer noopener">https://www.kernel.org/doc/html/next/admin-guide/blockdev/zram.html</a></p>



<h2 class="wp-block-heading" id="htoc-raspberry-pi-os">Raspberry Pi OS</h2>



<p>The classic Raspberry Pi OS by default creates a swap file in <code>/var</code> sized at 100MB.  The presense of SOME swap seems to alleviate most of the issues, however since most Raspberry Pi devices run off SD, there is a VERY LARGE performance hit to having the swap on flash. </p>



<p>The swap file is created by the<code> dphys-swapfile</code> service which configures the swap file on startup.  Before we configure ZRAM, we first should disable the swapfile.  This can be done by simply disabling the service (it will take effect on next boot).</p>



<pre class="wp-block-code"><code>sudo systemctl disable dphys-swapfile</code></pre>



<p>After we disable the swapfile, the next step is to install the ZRAM tools:</p>



<pre class="wp-block-code"><code>sudo apt install zram-tools</code></pre>



<p>The ZRAM configuration will all be done in <code>/etc/defaults/zramswap</code> file.  The default configuration will all be commented.  I will only edit the size value (configured in MB) to switch from 256MB to 2GB (my Pi4B is an 8GB model).  Set the size appropriate for your device (i.e. a Pi Zero with 512MB of RAM I would set to 128MB).</p>



<pre class="wp-block-code"><code>#ALGO=lz4
#PERCENT=50
SIZE=2048
#PRIORITY=100</code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p id="htoc-note-the-compression-algorithm-can-be-changed-to-increase-the-compression-or-decrease-the-cpu-usage-i-ll-leave-the-default-here-you-can-identify-what-algorithms-are-supported-by-your-kernel-by-running-cat-sys-block-zram0-comp-algorithm-after-you-have-booted-with-your-zram">NOTE:  The compression algorithm can be changed to increase the compression or decrease the CPU usage.  I&#8217;ll leave the default here.  You can identify what algorithms are supported by your kernel by running <code>cat /sys/block/zram0/comp_algorithm</code> after you have booted with your ZRAM.</p>
</blockquote>



<p>Reload to apply your changes.  At this point you should see 2GB of swap when you run <code>free -h</code>.  If you don&#8217;t see your swap space, check the status of the zramswap service to see what caused the failure.</p>



<pre class="wp-block-code"><code>$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.6Gi       141Mi       7.3Gi       1.0Mi       195Mi       7.4Gi
<mark>Swap:          2.0Gi          0B       2.0Gi</mark>
$ sudo systemctl status zramswap.service 
* zramswap.service - Linux zramswap setup
     Loaded: loaded (/lib/systemd/system/zramswap.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2023-06-16 14:08:33 MST; 20min ago
       Docs: man:zramswap(8)
    Process: 565 ExecStart=/usr/sbin/zramswap start (code=exited, status=0/SUCCESS)
   Main PID: 565 (code=exited, status=0/SUCCESS)
        CPU: 122ms

Jun 16 14:08:33 ... systemd&#91;1]: Starting Linux zramswap setup...
Jun 16 14:08:33 ... root&#91;575]: Starting Zram
Jun 16 14:08:33 ... zramswap&#91;575]: &lt;13&gt;Jun 16 14:08:33 root: Starting Zram
Jun 16 14:08:33 ... zramswap&#91;630]: Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
Jun 16 14:08:33 ... zramswap&#91;630]: no label, UUID=142f8653-e64b-4985-9c89-c129397cea8a
Jun 16 14:08:33 ... systemd&#91;1]: Finished Linux zramswap setup.
pi@rpi-kvm1:~ $ </code></pre>



<h2 class="wp-block-heading" id="htoc-ubuntu-23-04">Ubuntu 23.04</h2>



<p>I am currently running Ubuntu 23.04 on my Radxa Rock 5B, so I&#8217;ll use this as my example.  First we need to make sure the ZRAM packages are installed:</p>



<pre class="wp-block-code"><code>sudo apt install zram-config zram-tools</code></pre>



<p>After this is installed, then we can configure the <code>/etc/defaults/zramswap</code> just like we did with the Raspberry Pi.  One difference though, my kernel didn&#8217;t have LZ4 support, so I needed to swap to LZO-RLE:</p>



<pre class="wp-block-code"><code>ALGO=lzo-rle
#PERCENT=50 
SIZE=2048 
#PRIORITY=100</code></pre>



<p>After a reboot, we can check to see that the swap space was created.  Check the status of the zramswap service to see what caused the error.</p>



<pre class="wp-block-code"><code>~$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.5Gi       692Mi       6.1Gi        45Mi       846Mi       6.8Gi
Swap:          2.0Gi          0B       2.0Gi
$ sudo systemctl status zramswap.service 
● zramswap.service - Linux zramswap setup
     Loaded: loaded (/lib/systemd/system/zramswap.service; enabled; preset: enabled)
     Active: active (exited) since Fri 2023-06-16 14:21:15 MST; 9min ago
       Docs: man:zramswap(8)
    Process: 916 ExecStart=/usr/sbin/zramswap start (code=exited, status=0/SUCCESS)
   Main PID: 916 (code=exited, status=0/SUCCESS)
        CPU: 32ms

Jun 16 14:21:15 ... systemd&#91;1]: Starting zramswap.service - Linux zramswap setup...
Jun 16 14:21:15 ... zramswap&#91;923]: &lt;13&gt;Jun 16 14:21:15 root: Starting Zram
Jun 16 14:21:15 ... root&#91;923]: Starting Zram
Jun 16 14:21:15 ... zramswap&#91;936]: Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
Jun 16 14:21:15 ... zramswap&#91;936]: no label, UUID=14f66260-16d7-4031-894c-59245d11f6be
Jun 16 14:21:15 ... systemd&#91;1]: Finished zramswap.service - Linux zramswap setup.</code></pre>



<h2 class="wp-block-heading" id="htoc-debian-11-bullseye">Debian 11 (Bullseye)</h2>



<p>Debian only has a single package to install.  I&#8217;m using my Rock 5B for testing again, so no LZ4 compression available (this simply depends on the kernel).</p>



<pre class="wp-block-code"><code>sudo apt install zram-tools</code></pre>



<p>The /etc/defaults/zramswap is configured the same way:</p>



<pre class="wp-block-code"><code>ALGO=lzo-rle 
#PERCENT=50  
SIZE=2048  
#PRIORITY=100</code></pre>



<h2 class="wp-block-heading" id="htoc-summary">Summary</h2>



<p>Don&#8217;t forget to add some type of swap space!  For SBC&#8217;s ZRAM is ideal to prevent writing to the SD card for swap.  Raspberry Pi OS defaults to using a swap file, so disabling this and enabling ZRAM is ideal.  For Ubuntu or other Linux based distributions, be sure to install the ZRAM tools and configure the service.  If you are experiencing slow performance and system hangs (in particular in a GUI), be sure to check your swap configuration before you go any further!</p>



<p>If you are looking for more info on the Radxa Rock 5B, check out <a href="https://www.learningtopi.com/category/sbc/rock5b/">related articles</a>.</p>
<p>The post <a href="https://www.learningtopi.com/uncategorized/zram-for-your-sbc/">ZRAM for your SBC</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/uncategorized/zram-for-your-sbc/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Raspberry Pi 4B Setup for sbc_gpio</title>
		<link>https://www.learningtopi.com/sbc/raspberry-pi/raspberry-pi-4b-sbc_gpio/</link>
					<comments>https://www.learningtopi.com/sbc/raspberry-pi/raspberry-pi-4b-sbc_gpio/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Thu, 15 Jun 2023 06:22:10 +0000</pubDate>
				<category><![CDATA[Raspberry Pi SBC]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[overlays]]></category>
		<category><![CDATA[Pi4B]]></category>
		<category><![CDATA[python sbc_gpio]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=1031</guid>

					<description><![CDATA[<p>If you are looking for the results of the sbc_gpio tests, please check out our sbc_gpio Pi 4B vs Rock 5B comparison. Configuring the sbc_gpio for the Raspberry Pi 4B test requires 1x I2C, 2x SPI, 1x UART and 2x IR (1 Tx and 1 Rx). All the configuration can be done directly in the...</p>
<p>The post <a href="https://www.learningtopi.com/sbc/raspberry-pi/raspberry-pi-4b-sbc_gpio/">Raspberry Pi 4B Setup for sbc_gpio</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-1024x385.jpg" alt="" class="wp-image-80" width="635" height="238" srcset="https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-1024x385.jpg 1024w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-300x113.jpg 300w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-150x56.jpg 150w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-768x289.jpg 768w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-1536x578.jpg 1536w, https://www.learningtopi.com/wp-content/uploads/2022/04/Raspberry_Pi_4_Model_B_-_Side-streched-scaled-2048x770.jpg 2048w" sizes="auto, (max-width: 635px) 100vw, 635px" /></figure>
</div>


<p>If you are looking for the results of the <code>sbc_gpio </code>tests, please check out our <a href="https://www.learningtopi.com/sbc/sbc_gpio-pi-4b-vs-rock-5b/">sbc_gpio Pi 4B vs Rock 5B</a> comparison.</p>



<p>Configuring the <code>sbc_gpio </code>for the Raspberry Pi 4B test requires 1x I2C, 2x SPI, 1x UART and 2x IR (1 Tx and 1 Rx).  All the configuration can be done directly in the <code>/boot/config.txt</code> file.  Alternatively, some of the overlays may use the <code>raspi-config</code> tool (1x I2C, 1x SPI, 1x UART).</p>



<p>In all, the setup is quick and easy and only takes a few minutes.  RPI does support applying overlays without a reboot, however I generally just add the configuration and reboot to apply the changes.</p>



<div class="wp-block-ht-block-toc is-style-outline htoc htoc--position-wide toc-list-style-plain" data-htoc-state="expanded"><span class="htoc__title"><span class="ht_toc_title">Table of Contents</span></span><div class="htoc__itemswrap"><ul class="ht_toc_list"><li class=""><a href="#htoc-raspi-config-vs-boot-config-txt">Raspi-config vs /boot/config.txt</a></li><li class=""><a href="#htoc-i2c0-16x2-lcd-display1">I2C0 &#8211; 16&#215;2 LCD display</a></li><li class=""><a href="#htoc-spi0-bme280-bmp280">SPI0 &#8211; BME280 / BMP280</a></li><li class=""><a href="#htoc-spi1-bme280-bmp280">SPI1 &#8211; BME280 / BMP280</a></li><li class=""><a href="#htoc-uart0-for-serial-communication">UART0 &#8211; for serial communication</a></li><li class=""><a href="#htoc-infrared-transmit-and-receive">Infrared Transmit and Receive</a></li><li class=""><a href="#htoc-summary">Summary</a></li></ul></div></div>



<h2 class="wp-block-heading" id="htoc-raspi-config-vs-boot-config-txt">Raspi-config vs /boot/config.txt</h2>



<p>The <code>raspi-config </code>tool is a quick and easy way to setup your Raspberry Pi SBC for some of the typical overlays, but not all overlays are exposed using this tool.  For anything beyond the basics, you&#8217;ll need to edit the <code>/boot/config.txt</code> file directly.  You can also bypass the<code> raspi-config</code> tool and edit the <code>/boot/config.txt</code> file manually for all overlays if you prefer.  Where applicable I&#8217;ll show both methods for reference.</p>



<p>You can find a full breakdown of available /boot/config.txt file options on the <a href="https://www.raspberrypi.com/documentation/computers/config_txt.html" target="_blank" rel="noreferrer noopener">Raspberry Pi website</a>.</p>



<p>In the <code>raspi-config</code> tool, overlays can be accessed from the &#8220;Interface Options&#8221; menu:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="883" height="439" src="https://www.learningtopi.com/wp-content/uploads/image-32.png" alt="" class="wp-image-1032" srcset="https://www.learningtopi.com/wp-content/uploads/image-32.png 883w, https://www.learningtopi.com/wp-content/uploads/image-32-300x149.png 300w, https://www.learningtopi.com/wp-content/uploads/image-32-150x75.png 150w, https://www.learningtopi.com/wp-content/uploads/image-32-768x382.png 768w, https://www.learningtopi.com/wp-content/uploads/image-32-850x423.png 850w" sizes="auto, (max-width: 883px) 100vw, 883px" /></figure>



<h2 class="wp-block-heading" id="htoc-i2c0-16x2-lcd-display1">I2C0 &#8211; 16&#215;2 LCD display</h2>



<p>Only the 1st I2C bus can be configured from the <code>raspi-config</code> tool:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="964" height="447" src="https://www.learningtopi.com/wp-content/uploads/image-33.png" alt="" class="wp-image-1033" srcset="https://www.learningtopi.com/wp-content/uploads/image-33.png 964w, https://www.learningtopi.com/wp-content/uploads/image-33-300x139.png 300w, https://www.learningtopi.com/wp-content/uploads/image-33-150x70.png 150w, https://www.learningtopi.com/wp-content/uploads/image-33-768x356.png 768w, https://www.learningtopi.com/wp-content/uploads/image-33-850x394.png 850w" sizes="auto, (max-width: 964px) 100vw, 964px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="791" height="450" src="https://www.learningtopi.com/wp-content/uploads/image-34.png" alt="" class="wp-image-1034" srcset="https://www.learningtopi.com/wp-content/uploads/image-34.png 791w, https://www.learningtopi.com/wp-content/uploads/image-34-300x171.png 300w, https://www.learningtopi.com/wp-content/uploads/image-34-150x85.png 150w, https://www.learningtopi.com/wp-content/uploads/image-34-768x437.png 768w" sizes="auto, (max-width: 791px) 100vw, 791px" /></figure>



<p>Alternatively the following can be set in the <code>/boot/config.txt</code> file:</p>



<pre class="wp-block-code"><code>dtparam=i2c_arm=on</code></pre>



<h2 class="wp-block-heading" id="htoc-spi0-bme280-bmp280">SPI0 &#8211; BME280 / BMP280</h2>



<p>This uses our <code>dht11_spi</code> python library that uses the input on the SPI bus in conjunction with an output GPIO pin and a transistor to trigger and read the DHT11 sensor.  You can read more about the dht11_spi library <a href="https://www.learningtopi.com/sbc/python_dht11_spi/" target="_blank" rel="noreferrer noopener">here</a>.  Only the 1st SPI bus (spi0) can be configured using the <code>raspi-config</code> tool:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="964" height="447" src="https://www.learningtopi.com/wp-content/uploads/image-33.png" alt="" class="wp-image-1033" srcset="https://www.learningtopi.com/wp-content/uploads/image-33.png 964w, https://www.learningtopi.com/wp-content/uploads/image-33-300x139.png 300w, https://www.learningtopi.com/wp-content/uploads/image-33-150x70.png 150w, https://www.learningtopi.com/wp-content/uploads/image-33-768x356.png 768w, https://www.learningtopi.com/wp-content/uploads/image-33-850x394.png 850w" sizes="auto, (max-width: 964px) 100vw, 964px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" src="https://www.learningtopi.com/wp-content/uploads/image-35.png" alt="" class="wp-image-1036"/></figure>



<p>Alternatively the following can be set in the <code>/boot/config.txt</code> file:</p>



<pre class="wp-block-code"><code>dtparam=spi=on
dtoverlay=spi0-1cs
</code></pre>



<h2 class="wp-block-heading" id="htoc-spi1-bme280-bmp280">SPI1 &#8211; BME280 / BMP280</h2>



<p>Any SPI buses after the first need to be enabled from the <code>/boot/config.txt </code>file directly.  The following will enable the SPI1 bus with 1 CS.</p>



<pre class="wp-block-code"><code>dtoverlay=spi1-1cs</code></pre>



<h2 class="wp-block-heading" id="htoc-uart0-for-serial-communication">UART0 &#8211; for serial communication</h2>



<p>The UART0 interface will be used for sending serial traffic to a CP2102 USB to serial converter.  The CP2102 USB port will connect back to the SBC.  No drivers are needed for the CP2102 (necessary drivers are already present in the Linux kernel).</p>



<p>The UART0 serial port can be enabled using <code>raspi-config</code>.  The first question is used to enable a console port to the Raspberry Pi over UART0 (select NO).  The second question enables the UART0 interface for use by applications (select YES):</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="788" height="448" src="https://www.learningtopi.com/wp-content/uploads/image-39.png" alt="" class="wp-image-1044" srcset="https://www.learningtopi.com/wp-content/uploads/image-39.png 788w, https://www.learningtopi.com/wp-content/uploads/image-39-300x171.png 300w, https://www.learningtopi.com/wp-content/uploads/image-39-150x85.png 150w, https://www.learningtopi.com/wp-content/uploads/image-39-768x437.png 768w" sizes="auto, (max-width: 788px) 100vw, 788px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="786" height="452" src="https://www.learningtopi.com/wp-content/uploads/image-38.png" alt="" class="wp-image-1042" srcset="https://www.learningtopi.com/wp-content/uploads/image-38.png 786w, https://www.learningtopi.com/wp-content/uploads/image-38-300x173.png 300w, https://www.learningtopi.com/wp-content/uploads/image-38-150x86.png 150w, https://www.learningtopi.com/wp-content/uploads/image-38-768x442.png 768w" sizes="auto, (max-width: 786px) 100vw, 786px" /></figure>



<p>Alternatively, the UART can be enabled in the <code>/boot/config.txt </code>file:</p>



<pre class="wp-block-code"><code>enable_uart=1</code></pre>



<h2 class="wp-block-heading" id="htoc-infrared-transmit-and-receive">Infrared Transmit and Receive</h2>



<p>Infrared transmit or receive ports cannot be set using the <code>raspi-config </code>tool.  In the <code>/boot/config.txt</code> file the following will enable a transmit (gpio-ir-tx) and receive (gpio-ir) pin.  Replace the gpio_pin value with the appropriate number.</p>



<pre class="wp-block-code"><code>dtoverlay=gpio-ir,gpio_pin=23
dtoverlay=gpio-ir-tx,gpio_pin=24</code></pre>



<p>You can create additional transmit or receive IR devices by simply adding another dtoverlay line with a new gpio pin number.</p>



<h2 class="wp-block-heading" id="htoc-summary">Summary</h2>



<p>You will find that the Raspberry Pi platform is EXTREMELY well documented and running through the setup is a breeze.  None of the overlays required any complex configuration.  Most could be setup using the <code>raspi-config</code> wizard.  There was also no need to run any update tools after modifying the <code>/boot/config.txt </code>file (like on some other platforms).</p>



<p>If you came here from our&nbsp;<a href="https://www.learningtopi.com/sbc/sbc_gpio-pi-4b-vs-rock-5b/">sbc_gpio test result page</a>, feel free to jump back over to the results!</p>
<p>The post <a href="https://www.learningtopi.com/sbc/raspberry-pi/raspberry-pi-4b-sbc_gpio/">Raspberry Pi 4B Setup for sbc_gpio</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/raspberry-pi/raspberry-pi-4b-sbc_gpio/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Python bmx280_spi</title>
		<link>https://www.learningtopi.com/sbc/python-bmx280_spi/</link>
					<comments>https://www.learningtopi.com/sbc/python-bmx280_spi/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Sun, 21 May 2023 06:17:30 +0000</pubDate>
				<category><![CDATA[Python Libraries]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=947</guid>

					<description><![CDATA[<p>While working on my SBC comparison, in addition to building a new library to read DHT11/DHT22 sensors using the SPI bus, I had a hard time finding a working library to read BMP280/BME280 sensors using the SPI bus.  Most of the libraries utilized I2C, which in normal situations would be fine.  For this set of...</p>
<p>The post <a href="https://www.learningtopi.com/sbc/python-bmx280_spi/">Python bmx280_spi</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p></p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%">
<p>While working on my SBC comparison, in addition to building a new library to read DHT11/DHT22 sensors using the SPI bus, I had a hard time finding a working library to read BMP280/BME280 sensors using the SPI bus.  Most of the libraries utilized I2C, which in normal situations would be fine.  For this set of testing, I was specifically looking for a sensor using the SPI bus to verify connectivity on different platforms.  So, I kicked off a mini project to build a new library.</p>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"><div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/bmp280-e1684649697175.png" alt="" class="wp-image-984" width="194" height="256" srcset="https://www.learningtopi.com/wp-content/uploads/bmp280-e1684649697175.png 311w, https://www.learningtopi.com/wp-content/uploads/bmp280-e1684649697175-228x300.png 228w, https://www.learningtopi.com/wp-content/uploads/bmp280-e1684649697175-114x150.png 114w, https://www.learningtopi.com/wp-content/uploads/bmp280-e1684649697175-300x395.png 300w" sizes="auto, (max-width: 194px) 100vw, 194px" /></figure>
</div></div>
</div>



<p>For those unsure on whether to use SPI or I2C for a given sensor, one feature of the SPI bus that makes me tend to prefer it is the lack of bus addressing.  Most I2C devices I’ve seen tend to come with pre-defined I2C bus addresses.  Some devices allow you to switch the address between two different options by setting a jumper (or soldering a pad).  What do you do if you need two or more of the same sensors connected to an SBC or microcontroller?  SPI does require more cabling but using the CS (chip select) to identify the intended sensor allows for more flexibility.  If the number of cables isn’t an issue, I’ll likely use SPI wherever possible.</p>



<h3 class="wp-block-heading">Setting used by BME280/BMP280 sensors</h3>



<h4 class="wp-block-heading">Sensor Modes:</h4>



<ul class="wp-block-list">
<li><strong>Sleep Mode</strong>: Initial state after startup.  No sensor readings are running, all registers are accessible and consumes the lowest amount of power</li>



<li><strong>Forced Mode</strong>: Performs one measurement of enabled sensors and returns to sleep mode</li>



<li><strong>Normal Mode</strong>: Cycles between measuring enabled sensors and inactive periods between measurements</li>
</ul>



<p>When a “forced” read is called, the sensor will simply take a single reading and store the result.  Once the reading has been taken, the raw data can be read from the register.  When in normal mode, reads can be performed at any time.  Any read in normal mode will return whatever current raw data is presently stored in the memory registers.  With IIR filtering that will mean averaged data, or when filtering is disabled, whatever reading was taken last.</p>



<h4 class="wp-block-heading">IIR Filter (aka Oversampling)</h4>



<p>The description of the IIR filter took some time to sort out.  When the IIR Filter is enabled, the “filtered” data holds an average of x number of readings.  In some areas, this is called oversampling.  The documentation refers to IIR filtering to “reduce the noise”.  The concept here is averaging out readings to minimize brief variations in pressure or temperature.  The humidity sensor does not use IIR Filtering.  The IIR filter is only applicable when in normal mode.  The filter also applies to BOTH the temperature and pressure sensor (there isn’t an independent filter setting for each).  The filter is cleared when the sensor is placed in normal mode.  After the filter is cleared, all future readings are averaged in.  The higher the filter number, the lower the impact a single reading will have on the “filtered” value.</p>



<p>IIR filtering supports the following values: 0 (off), 2, 4, 8, and 16. </p>



<h4 class="wp-block-heading">Sensor Resolution</h4>



<p>The humidity sensor (BME280 only) always runs as a 16 bit ADC.  Pressure and temperature sensors default to 16 bit when the IIR Filter is disabled and can be set to 0 (disables the sensor), 1 (for 16 bit), 2 (for 17 bit) or 3 (for 18 bit).  When IIR Filtering is enabled, the pressure and temperature sensor run at a fixed 20 bit (higher resolution for averaged readings).</p>



<h4 class="wp-block-heading">Standby Time</h4>



<p>When running in normal mode, the BME280/BMP280 sensor will take readings on regular intervals.  In between each reading the sensor will sleep for the &#8220;standby” time before waking up and taking another reading.  When running in normal mode with the IIR filter enabled, the sensor will take readings and average the results into the stored result.  The datasheet for the BME280 and BMP280 disagree on the meaning of the standby time settings somewhat.  They agree on the sleep time for values 0-5 but differ on the meaning of 6 and 7.</p>



<p>Standby time supported values: 0 (0.5ms), 1 (62.5ms), 2 (125ms), 3 (250ms), 4 (500ms), 5 (1000ms), 6 (10ms in BME280 or 2000ms in BMP280), 7 (20ms in BME280 or 4000ms in BMP280).  I’m assuming that the values in the BME280 datasheet are in error and used the BMP280 values in my library.  If you want to be safe, stick with the 1 second interval or less.</p>



<h3 class="wp-block-heading">How it Works</h3>



<p>I named the library BMX280 because I wrote it to support both the BME280 and BMP280.  Both read temperature and air pressure, the BME adds a humidity sensor as well (for a premium price!).  Following the datasheets available from the manufacturer, it was clear that both sensors use the same set of registers and the same mechanism for sending and receiving data.</p>



<p>BME280 Datasheet: <a href="https://learningtopi.github.io/datasheets/bme280.pdf" target="_blank" rel="noreferrer noopener">https://learningtopi.github.io/datasheets/bme280.pdf</a></p>



<p>BMP280 Datasheet: <a href="https://learningtopi.github.io/datasheets/bmp280.pdf" target="_blank" rel="noreferrer noopener">https://learningtopi.github.io/datasheets/bmp280.pdf</a></p>



<p>All registers on the BME280/BMP280 sensor support either a read or write operation.  Configuration registers can be read or written, other registers are read only.  With all this information, it was easy to create a Python library to read and write to the registers.  The most difficult part by far was figuring out the trimmer parameters and how to take the raw data and convert it to usable temp, humidity and pressure data.  I won’t go through all the details of the math.  I’ll just say that there are 3 registers for temperature, 9 for pressure and 6 for humidity.  The value in these registers holds calibration data that is burned into the chip from the factory and is REQUIRED to calculate the proper values.</p>



<p>Now that the structure is done, I may go on to add a background polling to keep a list of values polled while in normal mode.  I can also take the SPI setup and port to I2C since the registers are the same, only the medium is changed.</p>



<p>Please check out our module documentation page here: &lt;/////></p>



<p>Also check out our SBC comparison project that this library was written for here: &lt;/////></p>
<p>The post <a href="https://www.learningtopi.com/sbc/python-bmx280_spi/">Python bmx280_spi</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/python-bmx280_spi/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Python dht11_spi</title>
		<link>https://www.learningtopi.com/sbc/python_dht11_spi/</link>
					<comments>https://www.learningtopi.com/sbc/python_dht11_spi/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Sun, 21 May 2023 05:48:22 +0000</pubDate>
				<category><![CDATA[Python Libraries]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=949</guid>

					<description><![CDATA[<p>I am currently working on a project to compare different SBC devices and compare the functionality to the gold standard, the Raspberry Pi 4B.&#160; Rather than just comparing specs, I am endeavoring to compare the GPIO functionality and support within Python. &#160;As a part of this comparison testing a grabbed a trusty old DHT11 and...</p>
<p>The post <a href="https://www.learningtopi.com/sbc/python_dht11_spi/">Python dht11_spi</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I am currently working on a project to compare different SBC devices and compare the functionality to the gold standard, the Raspberry Pi 4B.&nbsp; Rather than just comparing specs, I am endeavoring to compare the GPIO functionality and support within Python. &nbsp;As a part of this comparison testing a grabbed a trusty old DHT11 and found that it doesn’t work as well as it used to.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>NOTE:&nbsp; The DHT22 operates the same as the DHT11.&nbsp; There is a slightly different method required to read the binary data, however the data transfer is performed the same way.&nbsp; Other than the method to convert the binary data to a number, all references to the DHT11 can be interchanged with a DHT22.</p>
</blockquote>



<h3 class="wp-block-heading">What Has Changed?</h3>



<p>In later releases of the Linux kernel, how GPIO’s are accessed has moved away from direct “bit-banging” (the term widely used to reference directly accessing the GPIO registers) to API interfacing through the Linux kernel.&nbsp; On one side this provides accounting of what applications are using which pin and helps prevent improper use.&nbsp; On the other hand, it adds a layer between Python and the GPIO’s.</p>



<p>Reference:  <a href="https://waldorf.waveform.org.uk/2021/the-pins-they-are-a-changin.html">https://waldorf.waveform.org.uk/2021/the-pins-they-are-a-changin.html</a></p>



<h3 class="wp-block-heading">How does a DHT11 work?</h3>



<p>The trusty old DHT11 uses a slightly unusual method of operation.&nbsp; There is a single data pin that is used to trigger a read from the device (by pulling the data pin low for a minimum of 18 ms).&nbsp; Most DHT11 devices have 3 pins on a small PCB.&nbsp; The 3 pin model includes a pull-up resistor.&nbsp; 4 pin models without the PCB need to have an external pull-up resistor added.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/dht11-init.png" alt="" class="wp-image-955" width="587" height="205" srcset="https://www.learningtopi.com/wp-content/uploads/dht11-init.png 587w, https://www.learningtopi.com/wp-content/uploads/dht11-init-300x105.png 300w, https://www.learningtopi.com/wp-content/uploads/dht11-init-150x52.png 150w" sizes="auto, (max-width: 587px) 100vw, 587px" /><figcaption class="wp-element-caption">Image from DHT11 <a href="https://learningtopi.github.io/datasheets/dht11.pdf" target="_blank" rel="noreferrer noopener">Datasheet</a></figcaption></figure>
</div>


<p>After the DHT11 device is triggered by pulling the data pin to ground, the sensor starts transmitting binary data by pulling the data pin to ground and releasing.&nbsp; Each bit is preceded by a 50us pull to ground followed by a 0 or 1 represented by leaving the data pin high for 26-28us for a 0, or 70us for a 1.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="574" height="354" src="https://www.learningtopi.com/wp-content/uploads/dht11-0-bit.png" alt="" class="wp-image-956" srcset="https://www.learningtopi.com/wp-content/uploads/dht11-0-bit.png 574w, https://www.learningtopi.com/wp-content/uploads/dht11-0-bit-300x185.png 300w, https://www.learningtopi.com/wp-content/uploads/dht11-0-bit-150x93.png 150w" sizes="auto, (max-width: 574px) 100vw, 574px" /><figcaption class="wp-element-caption">Images from DHT11 <a href="https://learningtopi.github.io/datasheets/dht11.pdf" target="_blank" rel="noreferrer noopener">Datasheet</a></figcaption></figure>
</div>

<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/dht11-1bit.png" alt="" class="wp-image-957" width="582" height="330" srcset="https://www.learningtopi.com/wp-content/uploads/dht11-1bit.png 582w, https://www.learningtopi.com/wp-content/uploads/dht11-1bit-300x170.png 300w, https://www.learningtopi.com/wp-content/uploads/dht11-1bit-150x85.png 150w" sizes="auto, (max-width: 582px) 100vw, 582px" /></figure>
</div>


<p>To read the data transmitted by the DHT11 sensor, the application must be able to read the difference between a high voltage held for 27us and 70us!&nbsp; For reference 27us is 0.000027 seconds! Or .001 milliseconds!&nbsp; This is an incredibly small slice of time!</p>



<p>The classic DHT11 library (<a href="https://pypi.org/project/dht11/">https://pypi.org/project/dht11/</a>) does this by simply reading the value from the data pin in a loop until it has recorded 100 concurrent values the same.&nbsp; The loop (<a href="https://github.com/szazo/DHT11_Python/blob/master/dht11/__init__.py">https://github.com/szazo/DHT11_Python/blob/master/dht11/__init__.py</a>) is run without any delay added, so the data is collected as fast as the Python code can run.&nbsp; Even at the best of times, this was only successful for me somewhere around 50% of the time.&nbsp; The rest of the time the code wasn’t able to read the data quickly enough.&nbsp; On a modern board with a modern kernel this seems to be even worse.&nbsp; I found it rare to EVER get a successful read.&nbsp; The issue comes down to the speed of switching from an output pin to an input pin, then reading the input rapidly enough to capture the high and low values.</p>



<p>Are all DHT11 or DHT22 sensors simply useless in modern kernel devices?&nbsp; Are we stuck with either old out of date devices or upgrading to more expensive I2C or SPI temperature/humidity sensors?&nbsp; I was determined to look for an alternative.</p>



<h3 class="wp-block-heading">The Alternative for reading the DHT11 / DHT22!</h3>



<p>After pondering the issue, I started to think about what other components on the typical SBC can read data quickly enough to measure the difference between a high voltage held for 27us or 70us.&nbsp; After some quick conversion on unitjuggler.com (<a href="https://www.unitjuggler.com/convert-frequency-from-%C2%B5s(p)-to-Hz.html?val=27">https://www.unitjuggler.com/convert-frequency-from-%C2%B5s(p)-to-Hz.html?val=27</a>), I realized that 27us is just over 37kHz.&nbsp; It occurred to me that the SPI bus is capable of running in the 100’s of Mhz range (depending on platform of course).&nbsp; That makes the SPI bus hundreds of times more sensitive than needed to read the DHT11!</p>



<table id="tablepress-5" class="tablepress tablepress-id-5">
<thead>
<tr class="row-1">
	<th class="column-1">Part</th><th class="column-2">Link</th><th class="column-3">Cost (At time of writing)</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">DHT11</td><td class="column-2"><a href="https://amzn.to/3DCEH0W">At Amazon</a></td><td class="column-3">$13.99 for 10 ($1.40/ea)</td>
</tr>
<tr class="row-3">
	<td class="column-1">DHT22</td><td class="column-2"><a href= "https://amzn.to/3Y2BTm5">At Amazon</a></td><td class="column-3">$13.99 for 2 ($7.00/ea)</td>
</tr>
<tr class="row-4">
	<td class="column-1">2N5551 NPN Transistor</td><td class="column-2"><a href="https://amzn.to/3YiM59Y">At Amazon</a></td><td class="column-3">$13.99 for 450 assorted ($0.031/ea)</td>
</tr>
<tr class="row-5">
	<td class="column-1">1x 470Ω resistor</td><td class="column-2"><a href="https://amzn.to/3HvG6I6">At Amazon</a></td><td class="column-3">$11.99 for 525 assorted ($0.023/ea)</td>
</tr>
<tr class="row-6">
	<td class="column-1">1x 1kΩ resistor (for voltage divider)</td><td class="column-2"><a href="https://amzn.to/3HvG6I6">At Amazon</a></td><td class="column-3">$11.99 for 525 assorted ($0.023/ea)</td>
</tr>
<tr class="row-7">
	<td class="column-1">1x 2kΩ resistor (for voltage divider)</td><td class="column-2"><a href="https://amzn.to/3HvG6I6">At Amazon</a></td><td class="column-3">$11.99 for 525 assorted ($0.023/ea)</td>
</tr>
<tr class="row-8">
	<td class="column-1"><b>Total for 1x DHT11</b></td><td class="column-2"></td><td class="column-3"><b>$1.71</b></td>
</tr>
<tr class="row-9">
	<td class="column-1"><b>Total for 1x DHT22</b></td><td class="column-2"></td><td class="column-3"><b>$7.10</b></td>
</tr>
</tbody>
</table>
<!-- #tablepress-5 from cache -->


<p class="has-text-align-center"><em>As an Amazon Associate I earn from qualifying purchases</em>.&nbsp;<em>Ads and associate programs is how we pay for our content. Using our associate links supports our site!</em></p>



<p>This solves the problem of how to READ the data coming from the sensor but introduces a new problem.&nbsp; The SPI bus uses separate pins for CLK (used to sync the bus frequency to all devices), MISO (in from sensor), MOSI (out to sensor) and CS (used to signal to a sensor).&nbsp; The DHT sensor uses the equivalent of the CS and MISO on the same data pin.</p>



<p>My solution was to split the load between two pins.&nbsp; Read data on the MISO pin of the SPI bus but initiate the signal to the DHT11 to start transmitting its readings from another pin.&nbsp; The question was how to do this?&nbsp; My solution was to add a 470ohm resistor and a 2N5551 NPN transistor.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/dht11-spi_breadboard-702x1024.png" alt="" class="wp-image-970" width="330" height="481" srcset="https://www.learningtopi.com/wp-content/uploads/dht11-spi_breadboard-702x1024.png 702w, https://www.learningtopi.com/wp-content/uploads/dht11-spi_breadboard-206x300.png 206w, https://www.learningtopi.com/wp-content/uploads/dht11-spi_breadboard-103x150.png 103w, https://www.learningtopi.com/wp-content/uploads/dht11-spi_breadboard-768x1121.png 768w, https://www.learningtopi.com/wp-content/uploads/dht11-spi_breadboard-300x438.png 300w, https://www.learningtopi.com/wp-content/uploads/dht11-spi_breadboard-850x1240.png 850w, https://www.learningtopi.com/wp-content/uploads/dht11-spi_breadboard.png 971w" sizes="auto, (max-width: 330px) 100vw, 330px" /></figure>
</div>


<p>The “signal” pin is connected to the base of the NPN transistor via the 470ohm resistor (to prevent excessive current from being pulled through the signal pin).&nbsp; The collector leg of the NPN is connected to ground, and the emitter to the data pin on the DHT11.&nbsp;</p>



<p>When the NPN transistor is “energized” by setting the signal pin high, current is allowed to flow from the emitter to the collector which will draw the data pin on the DHT11 to ground.&nbsp; As long as the signal pin is kept high, the DHT11 data pin will be pulled to ground.&nbsp; Once the signal pin is set low again, the NPN transistor will allow the data pin to return to a high voltage provided by the pull-up resistor.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/dht11-triggered.png" alt="" class="wp-image-971" width="361" height="493" srcset="https://www.learningtopi.com/wp-content/uploads/dht11-triggered.png 503w, https://www.learningtopi.com/wp-content/uploads/dht11-triggered-219x300.png 219w, https://www.learningtopi.com/wp-content/uploads/dht11-triggered-110x150.png 110w, https://www.learningtopi.com/wp-content/uploads/dht11-triggered-300x410.png 300w" sizes="auto, (max-width: 361px) 100vw, 361px" /></figure>



<p>Step 1: Transistor is activated by output pin set to high causing the data pin on DHT11 to be pulled to ground (also the SPI MISO)</p>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://www.learningtopi.com/wp-content/uploads/dht11-data-flow.png" alt="" class="wp-image-973" width="442" height="482" srcset="https://www.learningtopi.com/wp-content/uploads/dht11-data-flow.png 629w, https://www.learningtopi.com/wp-content/uploads/dht11-data-flow-275x300.png 275w, https://www.learningtopi.com/wp-content/uploads/dht11-data-flow-138x150.png 138w, https://www.learningtopi.com/wp-content/uploads/dht11-data-flow-300x327.png 300w" sizes="auto, (max-width: 442px) 100vw, 442px" /></figure>



<p>Step 2: Output pin is set back to low, DHT11 starts transmitting and data is received on SPI MISO port.</p>
</div>
</div>



<p>Now that we have triggered the DHT11 sensor to start sending its data, we can use the SPI bus to read the data.&nbsp; Python has a library spidev (<a href="https://pypi.org/project/spidev/">https://pypi.org/project/spidev/</a>)&nbsp; that can be used to set the bus frequency and read data from the bus.&nbsp; Then it is simply a matter of counting how many 0 and 1 bits are received and factoring in the frequency of the SPI bus to determine how many sequential 1’s are needed to represent a 0 or 1 transmitted by the DHT sensor.</p>



<h3 class="wp-block-heading">Conclusion</h3>



<p>Bit-banging is getting more and more difficult.&nbsp; That doesn’t however mean that there are no other (and better) ways to work with sensors like the DHT11.&nbsp; Using the SPI bus to read the DHT11 sensor so far has given a 90+% success rate.&nbsp; This is far better than the bit banging library even on the older kernels where 25-50% I considered successful.&nbsp; There were projects I built that read the DHT11 3 times in a row in hopes that one of them would work.</p>



<p>Sometimes you need to find creative ways to perform tasks.&nbsp; Feel free to leave a note in the comments if you make use of the dht11_spi library or create a similar library to work around the kernel GPIO limitations.</p>
<p>The post <a href="https://www.learningtopi.com/sbc/python_dht11_spi/">Python dht11_spi</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/python_dht11_spi/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
