Sunday, July 30, 2017

Debugging the FMP RTOS on QEMU

A few weeks ago I participated in the 7th edition of Tokyo's self-made OS meetup (自作OSもくもく会). This event was held at Cybozu offices in Nihonbashi which are quite colourful and have great views.


During the event there were lots of presentations that touched topics such as file systems, UEFI, kernel page handling, or memory allocation algorithms. I also gave a talk on how to debug the TOPPERS FMP real-time operating system on QEMU.

Monday, July 24, 2017

Adachi fireworks 2017

A few days ago, I went to see Adachi's fireworks (hanabi 花火 in Japanese), famous for being the first of the year in Tokyo (Adachi is a ward in the north of Tokyo).


The fireworks are launched from the south bank of the Arakawa river near Kita-Senju station. However, I suggest watching them from the north bank since it's less crowded and the views are fantastic as well. Go to Umejima station and follow the red path to get a nice viewing spot.


The place does get crowded but unless you are going with a big group of people, you shouldn't need to go early to secure a spot. We were 4 people and arriving at 19:00, just half and hour before the fireworks, would have been completely fine.


About 12,000 fireworks were launched in just an hour (19:30 to 20:30). Some of them were really impressive and looked huge. I took lots of pictures with my phone, some of them were blurry but some were ok.


Sometimes pieces of the fireworks would fly and reach our viewing spot. I suggest you bring some sunglasses to protect your eyes from the dust and objects coming down. It had been a while since I last went to a fireworks festival, and it was a great experience.

Monday, July 17, 2017

Blinking an LED with a simple PIC microcontroller

There are many different PIC microcontrollers. Some of them are powerful enough to be used with an arduino-like framework (pinguino) and others are much more constrained. For the former, I suggest using this PIC18F2553 I/SO evaluation board. For the latter, I suggest using a PIC12F675 I/P (or a reference kit). Despite being small and cheap, the PIC12F675 can be powerful enough for many simple applications. Let's take a look at its specs:
  • 10-bit A/D converter (4 channels)
  • 6 GPIO pins
  • Timers
  • Analog comparator
  • Memory (ROM: 1K words, RAM: 64B, EEPROM: 128B)
To compile code for the PIC12F675 you need to install the MPLAB-X IDE and the free edition of the MPLAB XC8 (PIC12F675 is an 8-bit microcontroller) compiler.


Then, prepare a circuit like the one in the picture on a breadboard. The PIC12F675 contains an internal oscillator so you don't need to supply one. Here we are just connecting the GP2 pin to an LED with a resistor. Additionally, we connect VPP to VDD through a 10kohm resistor and VDD to VSS (ground) with a 0.1uF for programming the chip with Pickit3.


Build the example source code provided by Paolo Rognoni with the MPLAB-X IDE. Connect the board to a 5V power supply and program it with a Pickit3.

Important: if you just bought the Pickit3 and get a "Connection failed" error and a RED status LED, the firmware in your Pickit3 may need an update. In that case, download the Pickit3 programmer application (I had to use v3.10) and open it with the Pickit3 unplugged. Plug it in and click Tools > Check communication. Hopefully it will be connected. Next, click on Tools > Download Pickit operating system, and choose 'hex' to write onto pickit3. Then, click on Tools > Revert to MPLAB Mode and exit the application (if it says no permissions for writing, change the folder permissions to writable). Finally, start MPLAB IPE program (already installed with MPLAB X), click "Connect" and it will update the firmware for you.

An oil painting after so many years

When I was a teenager, I used to attend an oil painting class not far from my home in Renedo. During that time, I copied a few famous oil paintings such as Gustave Caillebotte's Le pont de l’Europe. After more than 15 years, I decided to make a new oil painting. The problem was that I had forgotten almost everything. Or that's what I thought. In fact, as I started reading and during the painting process I was able to recall most of the things I used to know. All that information was still there in my brain, just a little bit rusted!.


I began by coating a canvas board in dark green colours. Usually a canvas made of linen is best, but this was kind of an experiment so I just used a canvas board from the 100 yen store Daiso. After the green layer dried, I drew the line work on top of it. This time I just copied a portrait that I found on a random website.


It took me some time to recall the names of the oil paint colours that I used to use. For the skin tones, I had to do some research and ended up using ultramarine blue, yellow cadmium, red cadmium and titanium white.


My first tries were really horrible. I had to let the painting dry and redraw everything again for a few times. Instead of applying paint all over, I should have put special emphasis on getting the shapes and values correct at first.


After some iterations, I was finally getting a bit closer to the portrait I was copying from. The woman looks different but here I wanted to focus on recalling the colouring process.


The end result was a small success compared to the initial tries. I learned a lot from my mistakes and it was also useful to know how far I am from being a good painter. I decided to leave the painting untouched, and I'll try to use all the learned lessons for the next one.