Tuesday, 17 January 2023

Sipeed M1S : Linux

In my initial post on the M1S dock I described my first look at the M1S after I received it on 22DEC22.  It includes lots of hardware functionality and a good set of demo programs are described in the "Getting Started" tutorial.  I am more interested in its capability to run linux than as a platform to develop applications so I continued to go through the excellent tutorial to find out more.

For these tests we are using the static RAM rather than an SD card.  Instead of using an external tool to create an SD card we need to use Bouffalo DevCube software to burn firmware to PSRAM so that it can be used by the C906 and E907 cores.  

The "Getting Started" tutorial provides a sample Linux image and shows you how to use DevCube to burn  it to the M1S as Linux firmware.  There is also a Sipeed github site containing the SDK (Software Development Kit) so that you can build Linux yourself.  Unfortunately the image I built didn't work properly so I used the sample Linux image instead.  I successfully burned the image to SRAM and it booted straightaway.  The (readonly) rootfs is only 2MB and there is some temporary storage available, so it is a very basic system.  It does boot extremely quickly and has the basic linux functions.



I put the M1S into a case which came as part of the package, it all fits very nicely into a compact box which is very convenient to use.  I also soldered headers onto an M1S so that one of my three boards has GPIO pins available to attach sensors and other peripherals if necessary.



The M1S package also contains a JTAG debugger which plugs into the SD card holder.  Usage is explained in the tutorial but it is a bit advanced for me so I will leave it for the moment.

As a postcript, I checked my work to build a linux kernel and noticed that there is patch folder in the github SDK tree.  Investigating further I see there is a script on github:


I ran this script, rebuilt the software, and magically I have my own linux system that I can modify at will 😊

Conclusion

Thanks to a great Sipeed "Getting Started" document I now have a basic Linux system on my Sipeed M1S SBC.  Overall I have demonstrated lots of capabilities for the board but I probably need some assistance to do more useful things.  Since the board has only been available for a month I may have to wait for people to try things out and explain what they have done.  Regardless, it is a great project which Wu Casear has set in motion.

Sunday, 8 January 2023

Sipeed M1S

The Story so far

The first RISC-V linux boards at a reasonable price (below $100) started to become available in June 2021.  They were based on the T-Head C906 RISC-V 64 bit core, incorporated into an Allwinner D1 SoC.  T-Head is Alibaba's RISC-V subsiduary and I believe Alibaba have open-sourced the core to encourage community development.  I have been very fortunate to be able to try out these boards early on in their life cycle as they are made available.

Allwinner Nezha    - signed up to IndieGoGo crowdfunding 21st May 2021, received 22nd June

Sipeed Lichee RV   -  ordered from AliExpress 24 November 2021 and delivered 16th December

MangoPi MQ-Pro    - Ordered 19th July 2021 delivered 10th August.



Crowdfunding

Following on from the Allwinner D1, Bouffalo Labs have released the BL808 Soc, also based on the C906 core, incorporating some other smaller processors.  
Sipeed announced an IndieGogo crowdfunder for the M1S dock which I signed up for on 9th November 2022 and my chips arrived on 22nd December 2022.
The campaign seems to be organised by Wu Caesar who is one of the stalwarts of the Mainline Linux RISC-V telegram forum.



Hardware

The BL808 SoC is a bit unusual in that it has 3 CPUs on board, the fastest based on C906 RISC64 core is capable of running linux. The second core is an E907 and is used for auxiliary functions such as camera image processing.

It also has logic for AI and Image Processing.

Communication is provided with wifi and bluetooth connectivity and there are both UART and OTG USB serial connectors.

One of many intruiging functions is an inbuilt FFT accelerator.

The M1S configuration I purchased comes with a camera and SPI LCD screen, all for $15-$20.

The hardware is capable of running Linux and FreeRTOS is also available.


First Look

There are many exciting features of the M1S to investigate.  Of course I need to get Linux running and check it out but before I do that (and I will post later on any successes) I had a look to check out the Sipeed documentation.  Although the board only started shipping in December 2022 there is some excellent documentation and demo programs.

When I powered up the board, the first thing I saw was me!  The demo program repeatedly retrieves images from the onboard camera and displays them on the LCD screen.  Connecting the UART and OTG USB-C connectors to the PC, I could start Putty sessions on both.  The C906 connected port showed some sort of monitor command prompt and the E907 connection showed output messages from the camera screen processing.


The sipeed wiki provides an excellent getting started guide which I could follow to try out some demo programs.  It has an amazingly good facility to load programs.  Firstly you press the two side buttons and RST to put the system into u-burn mode.  This causes the OTG to display a small 5MB drive visible on the PC.  You then copy a program to the drive and, as soon as the copy is finished the demo starts up.  This is amazing to use, within 5s you can try a different program.
In addition to the initial camera demo my favourite is a small python interface which you can use to enter python programs which control the screen (or anything else you want to do).

In summary this is a great board, with lots of interesting features, and promising documentation which I am looking forward to iinvestigating further.





Saturday, 7 January 2023

Sonos world

 I know that Sonos audio products are high quality and expensive, but I have never been very tempted to get to know them better.  My home music listening is provided by an aging but good quality Sony hifi with impressive Eltax speakers.  In addition to a CD player (rarely used) and Tuner (non-DAB, little used) I have an RPi with USB DAC connected to the hifi which I use predominantly.  The RPi runs the venerable MPD (music player daemon) to play my albums, compilations, radio stations and chart downloads and I have developed a comprehensive web front-end application to control the system.  Although I am not considering swapping over to Sonos in my study, they could be installed elsewhere.   


 Alex has recently donated four Sonos Play:1 speakers to us and the time has come to see how good the sound is and how easy they are to setup and use.  The speakers are small but perfectly formed.  Sound is very clear and there is an impressive depth/bass considering how small they are.  Although they are very expensive they hold their value well and the five year-old models we have are worth about £80 each.  They are usually connected to wifi, although they do have bluetooth and ethernet interfaces, so there is no problem with cables snaking around the room/house.



Configuration

I decided to set the speakers up as two stereo pairs.  Configuration needs to be done using an Android or IoS app on a phone/iPad on the same wifi network as the speakers.  Setup was troublesome until we did a factory reset on each speaker.  I could then create a Sonos network for the house and add the speakers in.  The Sonos procedure does a good job of finding the devices, networking them and making them part of a system  As I had allocated the speakers to two locations Sonos suggested I use them as a stereo pair and identified left and right speakers for me.

Music

Sonos is geared up to work with paid music services, such as Spotify which I don't really like and I don't subscribe to.  To start off with the only music available is Sonos radio, which isn't much use but does let us check the speakers are working.  I added a Samba shared folder on my RPi NAS which contains the music I listened to and this provided me with plenty to listen to.  My music doesn't always have very good mp3tags as it comes from a variety of sources so it is best to access it via folder names rather than albums.  I could have added music libraries from my phone or iPad but as I don't expect to be the primary user I didn't.

The Sonos app makes it easy to control music from iPad or phone.  There is also a Windows Controller which I tend to use most.

Adding a TuneIn account and linking it to Sonos allows me to play a wide variety of radio stations.  There is a paid version, with a 7 day free trial.  I hope it isn't needed for playing common commercial stations.

Connectivity

So far the setup has used standard features.  My impression is that Sonos is generally a closed system and doing things differently from the way you want to would be difficult.

I was pleasantly surprised that the Bubbleupnp app I use could see and play music on Sonos devices without difficulty.

Home Assistant integration is stunningly simple.  Within a couple of minutes I could setup Sonos within HA and play any accessible music.

Finally I found that, if I want to, I can specify my MPD output as a stream into Sonos so I could play any music / source that I currently use through my web application.

Conclusion

I was very pleased and a little surprised at Sonos capabilities and compatibility.  It is the pre-eminent high quality music system so it should be good.  I have seen complaints that Sonos want you to upgrade to the latest equipment with new features, but the old speakers we have work well with the software.  The most impressive feature, by far, is the ability to listen to separate music on combinations of speakers throughout the house.  I know this isn't easy to achieve and I think this is where a proprietary environment is worthwhile.  I was also pleased that non-revenue-generating functions are not shut out.  You can listen to your own music on your own NAS or utilise your speakers in a limited fashion from other apps,

 


     

Monday, 2 January 2023

Sleep, relaxation, meditation - one

 Getting a good nights sleep is something which is very important to me.  When it happens life is easier and more enjoyable.  It isn't a subject I have blogged, but maybe it should be.  I will start an entry and see how it develops.  

Matt Walker

Annette suggested I listen to a podcast from Zoe Science and Nutrition, The secrets of Good Sleep, which is an interview with an expert Matthew Walker.  I found it most interesting.  As a full-time University researcher Matthew Walker is able to explain many aspects of sleep and how it is affected by external lifestyle factors.

Although it wasn't a "self-help" tutorial he did mention an effective technique for falling asleep is to imagine you are going on a well-known and enjoyable walk, then focus in granular detail on what you see, hear, feel, small etc...until you hear your alarm wake you up in the morning.

There were many other sensible ideas, which are backed by research, diet is important; coffee should not be drunk in the afternoon evening; quality and type of sleep have a major effect on memory.

 He appears to have a number of podcasts on the subject which may be worth listening to.

Insight Timer

I often use Insight Timer for relaxation or to help me sleep.  Some of my favourite teachers are Jennifer Piercy, David Ji and Sarah Blondin.  I regularly surprise myself by how easy it is to change to a more positive frame of mind, simply by listening to someone talk for 20 minutes.  Before I may be tense, jaded, anxious, irritable; after I am more relaxed, happier, thinking more clearly.  It takes no more effort than sitting being miserable so why not do it?

TV Viewing with Home Assistant and Chromecast

Previously I have investigated the capabilities of Chromecast (CC).  In addition to providing a number of apps to make a TV "smart" and play free / chargeable content, CC provides the capability to "cast" to the TV content from phone, iPad or PC.  Home Assistant (HA) leverages the casting capability, allowing me to choose media within HA and play it on the TV.

In effect, I now have the same capability for video as I do for music but the question remains what use is it?  When finding and playing a youtube video, it is usually easiest to use a PC or iPad.  When watching a film, it is usually easiest to save it in DLNA and use the TV remote to select it.

HA webhooks allow you to use Chrome to select scripts or automations which HA executes for you.  For example I can easily setup a webhook to play a Youtube video on the TV and I can use an input form to select the youtube id I want to play.  I found a number of videos that I (or Harry Junior) may want to watch simply by pasting the appropriate URL into a web page.  


It would be simpler to setup a drop down menu of choices but even better, especially for Harry Junior, is to be able to press the icon for one of his favourite videos on the iPad and watch it on the TV.  As of January 2023 "Speedie Didi" is his preferred vlogger so I set up a number of her videos for him.


I may setup more webpages along these lines if they prove useful.  It would certainly make it easier to find yotube videos I want to watch repeatedly.

My Own Favourite Pictures

 

1 Lu J Son, 8PM


2 Mrs Ferguson, Sunlight on Pool


3 Leah Helliwell, Chinese Pool
4 Jean Goodwin, Autumn Gold