RoadTest the Raspberry Pi 4 Model B (2GB) - Review

Table of contents

RoadTest: RoadTest the Raspberry Pi 4 Model B (2GB)

Author: embeddedguy

Creation date:

Evaluation Type: Development Boards & Tools

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: Any single-board computer like Raspberrypi. others include Beaglebone, NVIDIA Jetson nano which I have recently got!!. But considering community support and ease of getting started RPI is the best

What were the biggest problems encountered?: Well, I don't like SD cards. The reason is it is difficult to flash every now and then and those are very fragile and get corrupted easily. Apart from that worst case is to deal with them while formatting them in windows.

Detailed Review:

RaspberryPi 4 in this case 2 GB is the latest line of product provided by the raspberry pi foundation. It has several new features added compared to the earlier versions.  As one of the websites states this as follows....

 

image

The ultimate Raspberry Pi! The new Raspberry Pi 4 has up to 4GB of RAM, a faster quad-core CPU, supports dual display operation up to 4K resolution, Gigabit Ethernet, USB3.0, wireless LAN, Bluetooth 5.0, and power via USB-C. That's very close to a desktop PC!

 

  • 1.5GHz 64-bit quad-core ARM Cortex-A72 CPU ( ARM v8, BCM2837)
  • 1GB, 2GB or 4GB RAM (LPDDR4)
  • On-board wireless LAN - dual-band 802.11 b / g / n / ac
  • On-board Bluetooth 5.0, low-energy (BLE)
  • 2x USB 3.0 ports, 2x USB 2.0 ports
  • Gigabit Ethernet
  • Power over Ethernet (additionally requires the Raspberry Pi PoE HAT)
  • 40-pin GPIO header
  • 2 × micro HDMI ports (up to 4Kp60 supported)
  • H.265 (4Kp60 decode)
  • H.264 (1080p60 decode, 1080p30 encode)
  • OpenGL ES, 3.0 graphics
  • DSI display port, CSI camera port
  • Combined 3.5mm analog audio and composite video jack
  • Micro SD card slot
  • USB-C Power

 

The RPI4 needs a USB-C power supply.

 

I have decided to try flickhat gesture sensor which has an MGC3130 gesture controller provided by microchip. It can detect several kinds of gesture sensing such as Airwheel, Touch, Tap, Doubletap, direction change etc. Basically flickhat transmits electromagnetic waves around the surface and when there is interference by certain kinds of gestures it gets detected by the gesture controller present on board.

 

The hat has I2C interface and it also has programmable EIO's which can detect kind of gestures. There is already software available for flickhat devices on the given link https://github.com/PiSupply/Flick

 

I have tried the basic example to see the X, Y, Z position of the finger and movement like north>south, east>west, etc. It is performing very nice.

 

 

 

 

imageimage

 

The Linux Kernel development on RPI--4

 

 

Originally I was thinking to make some Yocto build for RPI-4 but due to some problems it was not possible for me, hence I give a try to Linux Kernel development. I will show you how to run a simple hello world program from the http://derekmolloy.ie/writing-a-linux-kernel-module-part-1-introduction/#prettyPhoto

 

First, you must search for Kernel headers

$ apt-cache search raspberrypi-kernel-headers

Then the next step is to install the kernel modules by the following command.

 

sudo apt-get install raspberrypi-kernel-headers

You can search for the active Kernel by typing uname -a command.

 

After that get the required files for this tutorial by typing the following

 

git clone https://github.com/derekmolloy/exploringBB.git

You should now go to the directory /exploringBB/extras/kernel/hello and type make you will be able to see hello.ko next time when you type ls.

 

now the next thing is to load the Kernel by doing

 

 

sudo insmod hello.ko

 

and remove the module by typing

 

sudo rmmod hello.ko

 

check the content by typing

 

tail -f kern.log

 

Oct 20 22:31:47 raspberrypi kernel: [33296.827042] EBB: Hello world from the RaspberryPi4 LKM!

Oct 20 22:32:21 raspberrypi kernel: [33330.100104] EBB: Goodbye world from the RaspberryPi4

But all of the examples I have shown above are for doing some basic functionality. It is always good to do something in real-time. At the same tutorial link, I found an example for blinking an LED connected to GPIO using a push-button. The tutorials are for Beaglebone but after doing some changes they are also working on RaspberryPi's. One might argue that a sinple LED can be blinked on GPIO using GPIO functionality or any other program but doing it with LKM is a different thing. first LKM runs from Kernel space rather than user space and next is it has very less overhead. Next, I will show you how to do that.

 

The following is the original code from Derek Molloy's post. For RaspberryPi you just need to change the GPIO number in the file to 27(I am using GPIO27).

 

* @file   gpio_test.c
* @author Derek Molloy
* @date   19 April 2015
* @brief  A kernel module for controlling a GPIO LED/button pair. The device mounts devices via
* sysfs /sys/class/gpio/gpio115 and gpio49. Therefore, this test LKM circuit assumes that an LED
* is attached to GPIO 49 which is on P9_23 and the button is attached to GPIO 115 on P9_27. There
* is no requirement for a custom overlay, as the pins are in their default mux mode states.
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/gpio.h>                 // Required for the GPIO functions
#include <linux/interrupt.h>            // Required for the IRQ code
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Derek Molloy");
MODULE_DESCRIPTION("A Button/LED test driver for the BBB");
MODULE_VERSION("0.1");
static unsigned int gpioLED = 27;       ///< hard coding the LED gpio for this example to P9_23 (GPIO49)
static unsigned int gpioButton = 115;   ///< hard coding the button gpio for this example to P9_27 (GPIO115)
static unsigned int irqNumber;          ///< Used to share the IRQ number within this file
static unsigned int numberPresses = 0;  ///< For information, store the number of button presses
static bool     ledOn = 0;          ///< Is the LED on or off? Used to invert its state (off by default)
/// Function prototype for the custom IRQ handler function -- see below for the implementation
static irq_handler_t  ebbgpio_irq_handler(unsigned int irq, void *dev_id, struct pt_regs *regs);
/** @brief The LKM initialization function
*  The static keyword restricts the visibility of the function to within this C file. The __init
*  macro means that for a built-in driver (not a LKM) the function is only used at initialization
*  time and that it can be discarded and its memory freed up after that point. In this example this
*  function sets up the GPIOs and the IRQ
*  @return returns 0 if successful
*/
static int __init ebbgpio_init(void){
   int result = 0;
   printk(KERN_INFO "GPIO_TEST: Initializing the GPIO_TEST LKM\n");
   // Is the GPIO a valid GPIO number (e.g., the BBB has 4x32 but not all available)
   if (!gpio_is_valid(gpioLED)){
      printk(KERN_INFO "GPIO_TEST: invalid LED GPIO\n");
      return -ENODEV;
   }
   // Going to set up the LED. It is a GPIO in output mode and will be on by default
   ledOn = true;
   gpio_request(gpioLED, "sysfs");          // gpioLED is hardcoded to 49, request it
   gpio_direction_output(gpioLED, ledOn);   // Set the gpio to be in output mode and on
// gpio_set_value(gpioLED, ledOn);          // Not required as set by line above (here for reference)
   gpio_export(gpioLED, false);             // Causes gpio49 to appear in /sys/class/gpio
                     // the bool argument prevents the direction from being changed
   gpio_request(gpioButton, "sysfs");       // Set up the gpioButton
   gpio_direction_input(gpioButton);        // Set the button GPIO to be an input
   gpio_set_debounce(gpioButton, 200);      // Debounce the button with a delay of 200ms
   gpio_export(gpioButton, false);          // Causes gpio115 to appear in /sys/class/gpio
                     // the bool argument prevents the direction from being changed
   // Perform a quick test to see that the button is working as expected on LKM load
   printk(KERN_INFO "GPIO_TEST: The button state is currently: %d\n", gpio_get_value(gpioButton));
   // GPIO numbers and IRQ numbers are not the same! This function performs the mapping for us
   irqNumber = gpio_to_irq(gpioButton);
   printk(KERN_INFO "GPIO_TEST: The button is mapped to IRQ: %d\n", irqNumber);
   // This next call requests an interrupt line
   result = request_irq(irqNumber,             // The interrupt number requested
                        (irq_handler_t) ebbgpio_irq_handler, // The pointer to the handler function below
                        IRQF_TRIGGER_RISING,   // Interrupt on rising edge (button press, not release)
                        "ebb_gpio_handler",    // Used in /proc/interrupts to identify the owner
                        NULL);                 // The *dev_id for shared interrupt lines, NULL is okay
   printk(KERN_INFO "GPIO_TEST: The interrupt request result is: %d\n", result);
   return result;
}

The next step is to make the project by going to the /exploringBB/extras/kernel/gpio_test $ directory and typing make command. Then the next part is to insmod the build kernel .ko file by typing sudo insmode filename. You will see that an LED will be blinking on the GPIO 27.

 

 

imageimage

 

 

 

Overall it was a wonderful experience working with RaspberryPi 4 and especially running some of the LKM module examples. The RPI4 is fast compared to the previous versions of RaspberryPi's.

 

Next, I am doing some Neural Network stuff.............

Anonymous
Parents
  • IMO, That felt like incomplete review?!

    Could you please add up more to it, your own good work in it, other than some basic information ?

    Like:-

    The RPI4 is fast compared to the previous versions of RaspberryPi's.

    How did you reach to that conclusion?

    What were the biggest problems encountered?:  Wanted to make some yocto linux distribution for RPI4 but it wasn't possible.

    Better describe the problem you faced and how you tackled them..

    And I always felt like giving 60/60 in roadtests is a bit too generous.. Please don't mind, but I'm giving an honest comment on this review.

    It will definitely be good if you add any of your work to it.

    Keep doing good work. image

    -Mudz

Comment
  • IMO, That felt like incomplete review?!

    Could you please add up more to it, your own good work in it, other than some basic information ?

    Like:-

    The RPI4 is fast compared to the previous versions of RaspberryPi's.

    How did you reach to that conclusion?

    What were the biggest problems encountered?:  Wanted to make some yocto linux distribution for RPI4 but it wasn't possible.

    Better describe the problem you faced and how you tackled them..

    And I always felt like giving 60/60 in roadtests is a bit too generous.. Please don't mind, but I'm giving an honest comment on this review.

    It will definitely be good if you add any of your work to it.

    Keep doing good work. image

    -Mudz

Children