<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Porting the PaPiRus HAT to the MDK</title><link>/products/manufacturers/moto-mods/b/blog/posts/porting-the-papirus-hat-to-the-mdk</link><description>At the end of July, a couple of Motorola software engineers formed a Hackathon team to bring up the PaPiRus E-Ink display on a MotoZ phone using the new Mods Development Kit . Most of the work consisted of porting the existing open-source displa...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Porting the PaPiRus HAT to the MDK</title><link>https://community.element14.com/products/manufacturers/moto-mods/b/blog/posts/porting-the-papirus-hat-to-the-mdk</link><pubDate>Sun, 11 Sep 2016 23:40:01 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:fd6cc5b3-3481-4d85-828b-da3088059bcf</guid><dc:creator>freund</dc:creator><slash:comments>0</slash:comments><description>&lt;p dir="ltr"&gt;&lt;span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/d81edb7b189001f827933afaea04219ab2852c6b" rel="nofollow ugc noopener" target="_blank"&gt;Commit #8&lt;/a&gt;: “Shows cat and display image after clear”&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;epd.spi.h: 53: SPI_send_image() not used&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Epd.c:202: epd-&amp;gt;middle_scan=true: probably not needed as that’s the default value for the display firmware&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Commenting: frame_data_repeat().&amp;nbsp; This code is needed but we couldn’t get the full pipeline of drawing to work according to spec.&amp;nbsp; So our compromise was to feed inverted images to the draw_image function and skip the final inversion step.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Epd.c: has lots of dead commented code that’s not needed&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Epd_spi.c:135 up_udelay(500): RPi has a more powerful CPU than our MuC.&amp;nbsp; Since we spend more time sending the image data, we need to dial down the delay beetween bytes.&amp;nbsp; We tuned this value to optimize performance but still get the send to work&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=1990&amp;AppID=142&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Porting the PaPiRus HAT to the MDK</title><link>https://community.element14.com/products/manufacturers/moto-mods/b/blog/posts/porting-the-papirus-hat-to-the-mdk</link><pubDate>Sun, 11 Sep 2016 23:39:36 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:fd6cc5b3-3481-4d85-828b-da3088059bcf</guid><dc:creator>freund</dc:creator><slash:comments>0</slash:comments><description>&lt;p dir="ltr"&gt;&lt;span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/2a0f1e27be0619fd7b16eb4ce06d572900a7f506" rel="nofollow ugc noopener" target="_blank"&gt;Commit #7&lt;/a&gt;: “&lt;/span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/2a0f1e27be0619fd7b16eb4ce06d572900a7f506" rel="nofollow ugc noopener" target="_blank"&gt;&lt;span&gt;Finally clear display routine works&lt;/span&gt;&lt;/a&gt;&lt;span&gt;”. &lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;Get SPI driver to compile and clear works.&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;MDK’s spi_send API should be able to support bi directional communication with a separate R and W buffer, but we couldn’t get it working, so in epd_spi.h:50, we made use of the MDK’s spi_send routine’s return value to support the R/W bi-directional communication.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Epd.c:41 needed to use mdk’s sleep functions included by mdk.h.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Epd.c:350: Delay_ms(1) is needed before every spi_send.&amp;nbsp; It’s part of the PD protocol needed to initialize the control signal for SPI.&amp;nbsp; This was found on p.15 of the PD spec. Under the “/cs” graph.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Stm32_spi.c: 1444: RPi’s epd_spi utility code did not clear the LSBFIRST bit.&amp;nbsp; The MDK doesn’t support configuration of those clear bits, so we had no choice but to edit the MDK’s SPI code to NOT clear that bit.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Stm32_cpi.c: spi_portinitialize1() is dead code, should be ignored&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=1990&amp;AppID=142&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Porting the PaPiRus HAT to the MDK</title><link>https://community.element14.com/products/manufacturers/moto-mods/b/blog/posts/porting-the-papirus-hat-to-the-mdk</link><pubDate>Sun, 11 Sep 2016 23:38:41 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:fd6cc5b3-3481-4d85-828b-da3088059bcf</guid><dc:creator>freund</dc:creator><slash:comments>0</slash:comments><description>&lt;p dir="ltr"&gt;&lt;span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/4db105d6afc085e5ef1e31e1975a3f6e33425097" rel="nofollow ugc noopener" target="_blank"&gt;Commit #6&lt;/a&gt;: “&lt;/span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/4db105d6afc085e5ef1e31e1975a3f6e33425097" rel="nofollow ugc noopener" target="_blank"&gt;&lt;span&gt;Change the epd driver so now we are able to read cod version and it is 2&lt;/span&gt;&lt;/a&gt;&lt;span&gt;”&amp;nbsp; &lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;Get epd to compile.&amp;nbsp; Display version code can successfully read the HW, but nothing else works.&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;Uploading stm32_spi.c from MDK with no modification yet&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Epd.c:322: Add code to read cog_id which returns a value of 2 (ie, the 2.0” display)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;364: Support clearing display by breaking 2 byte send commands into 1 byte&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;339: Port “Check breakage” (of display HW) code by breaking 2 bytes into 1 byte send commands&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Note that PD spec indicates that SPI_SELECT must be called before and after each Send&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Epd_test.c:55 changing reset_pin direction to 1 is fixing our own bug&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Spi.c was renamed to epd_spi.c.&amp;nbsp; All ioctl from RPi was changed to SPI_SEND, for example:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;if (-1 == ioctl(spi-&amp;gt;fd, SPI_IOC_MESSAGE(1), transfer_buffer)) {&lt;/span&gt;&lt;span&gt;To&lt;/span&gt;&lt;span dir="ltr"&gt;&lt;span&gt;SPI_SNDBLOCK&lt;/span&gt;&lt;span&gt;(spi, buffer, length);&lt;/span&gt;&lt;/span&gt;&lt;span&gt;This wasn’t captured by the github change diff because the file was renamed.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span dir="ltr"&gt;&lt;span&gt;SPI_create for RPi uses fopen, was changed to &lt;/span&gt;&lt;span&gt;spi_create which calls up_spiintialize(1) // SPI1&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Set_spi_mode from rPi used icotls sets 3 values.&amp;nbsp; Epd_spi.c accomplishes that on line 162 with:&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span dir="ltr"&gt;&lt;span&gt;SPI_SETMODE&lt;/span&gt;&lt;span&gt;(spi,in_mode);&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span dir="ltr"&gt;&lt;span&gt;SPI_SETBITS&lt;/span&gt;(spi,&lt;span&gt;8&lt;/span&gt;);&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span dir="ltr"&gt;&lt;span&gt;SPI_SETFREQUENCY&lt;/span&gt;(spi,EPD_SPI_BPS);&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=1990&amp;AppID=142&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Porting the PaPiRus HAT to the MDK</title><link>https://community.element14.com/products/manufacturers/moto-mods/b/blog/posts/porting-the-papirus-hat-to-the-mdk</link><pubDate>Sun, 11 Sep 2016 23:37:32 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:fd6cc5b3-3481-4d85-828b-da3088059bcf</guid><dc:creator>freund</dc:creator><slash:comments>0</slash:comments><description>&lt;p dir="ltr"&gt;&lt;span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/d8088e2ff3b79e36a9cb441097ecab9aa320d792" rel="nofollow ugc noopener" target="_blank"&gt;Commit #5&lt;/a&gt;: “&lt;/span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/d8088e2ff3b79e36a9cb441097ecab9aa320d792" rel="nofollow ugc noopener" target="_blank"&gt;&lt;span&gt;Port the RaspberryPi driver to adapt to Mod HDK&lt;/span&gt;&lt;/a&gt;&lt;span&gt;”.&amp;nbsp; &lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;Compile epd driver and test code.&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;map SPI structure to MDK library&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Make use of remapped GPI r/w API’s &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Update include path for epd.h to point to compile time arch/board folder&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Nuttx C compiler doesn’t like variables to be declared inside of another statement such as a for loop.&amp;nbsp; Similarly, the compiler got confused about re-using name of variable in nested scope on epd.c:739&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Change RPi warn/error logging to MDK’s given dbg log function&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Epd_test.c: strip down to 1 test case (clear screen)&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=1990&amp;AppID=142&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Porting the PaPiRus HAT to the MDK</title><link>https://community.element14.com/products/manufacturers/moto-mods/b/blog/posts/porting-the-papirus-hat-to-the-mdk</link><pubDate>Sun, 11 Sep 2016 23:36:39 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:fd6cc5b3-3481-4d85-828b-da3088059bcf</guid><dc:creator>freund</dc:creator><slash:comments>0</slash:comments><description>&lt;p dir="ltr"&gt;&lt;span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/f4c7b622495fd478aa956dee7db1fcca105f580d" rel="nofollow ugc noopener" target="_blank"&gt;Commit #4&lt;/a&gt;: “Configure GPIO’s in the HDK and test it using RAW command and LEDs”.&amp;nbsp; &lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;Test code to verify that GPIO pins can be turned on and off using a Raw command&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;Gpio_test.h: original epd source&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Mods.h: Add pin definitions. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Gpio_test.c: Remap gpio function names&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=1990&amp;AppID=142&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Porting the PaPiRus HAT to the MDK</title><link>https://community.element14.com/products/manufacturers/moto-mods/b/blog/posts/porting-the-papirus-hat-to-the-mdk</link><pubDate>Sun, 11 Sep 2016 23:35:41 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:fd6cc5b3-3481-4d85-828b-da3088059bcf</guid><dc:creator>freund</dc:creator><slash:comments>0</slash:comments><description>&lt;p dir="ltr"&gt;&lt;span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/2ce361e5d7ee8d701ac5471be9c17448296d77b2" rel="nofollow ugc noopener" target="_blank"&gt;Commit #3&lt;/a&gt;: “Raspberri Pi epd driver drop”&amp;nbsp; Dropping more original &lt;a class="jive-link-external-small" href="http://www.pervasivedisplays.com/products/200" rel="nofollow ugc noopener" target="_blank"&gt;Pervasive Display&lt;/a&gt; source.&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;Makefile: No change from blinky&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;All headers and src are original epd source with original filenames&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=1990&amp;AppID=142&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Porting the PaPiRus HAT to the MDK</title><link>https://community.element14.com/products/manufacturers/moto-mods/b/blog/posts/porting-the-papirus-hat-to-the-mdk</link><pubDate>Sun, 11 Sep 2016 23:33:39 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:fd6cc5b3-3481-4d85-828b-da3088059bcf</guid><dc:creator>freund</dc:creator><slash:comments>0</slash:comments><description>&lt;p dir="ltr"&gt;&lt;span&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/7bd329e6e1831c1d5549dd7e292198dcbb88e6aa" rel="nofollow ugc noopener" target="_blank"&gt;Commit #2&lt;/a&gt;: Configuring the new project&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;Hdk-blinky.mnfs: Change name, remove unnecessary string&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Defconfig: &lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;Enable SPI1 for communicating from Mod to E-Ink display&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Set VID=42 (Developer ID as per MDK instructions)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Enable RAW, disable RAW_BLINKY (Note, we could have followed the template to create a RAW_EPD, but it’s not necessary)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;DISABLE_POSIX_TIMER: epd driver needs to use these timers from the MuC.&amp;nbsp; Fixed a compilation problem in epd.c.&amp;nbsp; Found to be necessary in later commit: d8088e2ff3b79e36a9cb441097ecab9aa320d792&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Stm32_modsraw.c: Need to add a log statement so we can see our raw commands coming through from the phone to our kernel code.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=1990&amp;AppID=142&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Porting the PaPiRus HAT to the MDK</title><link>https://community.element14.com/products/manufacturers/moto-mods/b/blog/posts/porting-the-papirus-hat-to-the-mdk</link><pubDate>Sun, 11 Sep 2016 23:30:54 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:fd6cc5b3-3481-4d85-828b-da3088059bcf</guid><dc:creator>freund</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;a class="jive-link-external-small" href="https://github.com/uxshared/motomod-epd/commit/bf522315a566f31050be4c8ab1edc362c4b82f09" rel="nofollow ugc noopener" target="_blank"&gt;Commit #1&lt;/a&gt;: Creating a new MDK project&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In this step, we&amp;#39;ll clone the MDK&amp;#39;s sample &amp;quot;Blinky&amp;quot; project into a new &amp;quot;epd&amp;quot; project (named after the RPi &amp;quot;epd.c&amp;quot; display driver for PaPiRus)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span&gt;First copy the hdk-blinky.mnfs manifest and change the filename&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Create an &amp;quot;epd&amp;quot; directory (named after the RPi &amp;quot;epd.c&amp;quot; display driver), and copied muc/blinky/Make.defs, setenv.sh, defconfig to this folder&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Built the new &amp;quot;epd&amp;quot; project:&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;blockquote class="jive-quote"&gt;&lt;p dir="ltr"&gt;&lt;span&gt;$ export PATH=$PATH:$BUILD_TOP/manifesto:$BUILD_TOP/bootrom-tools &lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;$ cd $BUILD_TOP/nuttx/nuttx &lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span style="font-style:italic;"&gt;# Needed if you previously built any other project, and are now ready to switch to our new epd project&lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;$ make distclean &lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span&gt;$ cd $BUILD_TOP/nuttx/nuttx/tools &lt;/span&gt;&lt;/p&gt;&lt;p dir="ltr"&gt;&lt;span style="font-style:italic;"&gt;# Copy files from epd directory to muc platform&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;$ ./configure.sh hdk/muc/&lt;/span&gt;&lt;span&gt;epd&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;At this point, we should be ready to flash our new epd (&amp;quot;blinky&amp;quot;) project as per the &lt;a class="jive-link-external-small" href="http://developer.motorola.com/build/tools/flashing-firmware" rel="nofollow ugc noopener" target="_blank"&gt;MDK flashing instructions&lt;/a&gt;.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=1990&amp;AppID=142&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>