ECE472/572 (UCLX) Assignment 10

Prepare for the lab - direct questions

Answer these questions while doing this lab – they will help you understand the procedure and better prepare for the tests.

Prepare for the lab - indirect questions

Activity 1 (20pts.)

  1. Find and inspect the Linux rtc device. Run ls -l /dev/rt*
  2. Capture the screen that shows who can access the device and to what capacity.
  3. Change the access restrictions and add another alias for the rtc device:
    1. Run udevadm info -a -p /sys/class/rtc/rtc0 and observe its output
    2. Edit/create the content of the file /etc/udev/rules.d/10-local.rules and add the following line:
      SUBSYSTEM=="rtc" KERNEL=="rtc0" SYMLINK="clock" MODE="0666" GROUP="uclinux"
    3. Run sudo udevadm control --reload-rules
    4. Run sudo udevadm trigger
  4. Run ls -l /dev/rt* /dev/cl*
  5. Capture the view of the output of the ls command above.
  6. Refer to the example program that illustrates use of direct read and write as well as ioctl in order to access features of the RTC device. Write a short program that accesses /dev/rtcx or its equivalent and prints the current time of the hardware clock.
    1. Use the following loose program outline. Please note that we will read the clock state not by reading from the device file (like we did in case of joystick) but instead by executing ioctl with parameter RTC_RD_TIME and the pointer to a variable of type rtc_time.
  7. Capture the view of the output of the program you wrote.
  8. Pack together using tar-gz or tar-bz the three screen captures and the source code of the program.

Activity 2(20pts.)

The activity for BB and RPI was tested by Madison Straubhaar, class of 2017.

  1. Provide a typescript or alternatively a series screen capture starting with running running uname -a followed  ls -alF /sys/class/gpio as well as the contents of each of the activated pin directory.
  2. Inspect the GPIO access description provided on ARMhf Web site.
  3. Test you ability to set up and control the digital IO pins on the board of your choice. Use sudo only if absolutely necessary.
    In case you cannot find the location of GPIO drivers for your board - redo Lab 6 correctly and put it on your SD card. Pay attention to the correct settings of make linux-menuconfig.
    1.  Inspect what  needs to be done to set up one of the on-board LED pins as an output and control it. Use shell commands like
      1. echo "text" > /device_nae_with_path
      2. cat /device_nae_with_path
      3. inspect the results of each step using ls -l /path_as_needed
    2. In case the pin of your choice was already set up, remove the settings so that the pin is no longer available. Document as needed.
    3. Activate the gpio pin as an output pin. Verify using appropriate ls -l commands. Write down what you did. Document as needed.
    4. Verify that you can control the LED by sending subsequently "0" and "1" several times and observing the LED behavior.
  4. In the regular Linux box:
    1. Write a short program in C that toggles one of the board LEDs once per second.
    2. UseUse open the file for writing, write to the file, close the file sequence instead of each echo redirection
    3. Use open the file for reading, read a line from the file, and close the file sequence instead of each cat
  • Cross-compile your program and transfer it to the board.
  • Test your program by running it on the board. Use sudo only if absolutely necessary.
  • Pack together using tar-gz or tar-bz the screen captures or typescript(s) and the source code of the program.
  • Details for BeagleBone

    The LEDs on the BBB are on GPIrootOs 53,54,55,56 pin numbers.
    The S2/boot button is on GPIO 72 pin number. (pressed value is 0, released value is 1.)

    Details for RaspberryPi

    First, disable the predefined actions on the two LEDs (until the next system reboot):
    echo none > /sys/class/leds/led0/trigger
    echo none > /sys/class/leds/led1/trigger

    The GREEN LED is on GPIO47.
    The RED LED is on GPIO35.
    The USB high power mode LED is on GPI38.
    Raspberry Pi3B design disabled direct access to these LEDs using low-level GPIO. Instead, you have to use the predefined devices located at /sys/class/leds/.

    Submission

    Drop the file with the information collected during the exercise as instructed in the corresponding assignment drop box on Sakai.

    Thank you.

    web site front local main page local list page general bookmarks software bookmarks go back copyright info