Arria10 Dev board LCD source code

This should be simple, but I haven’t found the magic yet.

I’m simply trying to find example user space code to write to the LCD on the Arria10 Development board using the GSRD. I know the drivers are there and working because I can write text to the LCD via the embedded web server. I just can’t find an example of how to do the same from user-space c code.

You can write to it very simply by just echoing text to it from the command line (this may be a helpful first step regardless of the end goal). Look in the /dev folder for the correct name but i believe it will always show up as ttyLCD0:
echo “Testing LCD” > /dev/ttyLCD0

From user space you can create code to open the same path and perform writes very similar to a file, such as :
lcd_handle = open(“/dev/ttyLCD0”, write)
fprintf(lcd_handle, “First Line\nSecod Line”)

This website may have some useful information for you, click or search for LCD:

FYI, if you’re like me, and want to know where the IP address gets written to the LCD it is in the startup script called:
a10_soc_devkit_gsrd\rootfs\usr\bin\altera-gsrd-init.sh

That path may be pretty old (i haven’t used the GHRD in a few years so it may have moved) but I will paste the whole script here for reference:

Blockquote
#!/bin/sh

This script loads the gpio-altera module and the LED scrolling application,

updates the LCD with IP address obtained

if [ “cat /sys/class/fpga/fpga0/status” == “user mode” ]; then
modprobe gpio-altera
if [ $? != 0 ]; then
echo “WARNING: Failed to load Altera GPIO module.
Web server and application for FPGA LED control will not work”
else
/www/pages/cgi-bin/scroll_server &
fi

modprobe altera_sysid
if [ $? != 0 ]; then
echo “WARNING: Failed to load Altera Sys ID module.”
fi
fi

Loads the PMBUS module on Arria10

if [ “cat /sys/devices/soc0/machine” == “Altera SOCFPGA Arria 10” ]; then
echo pmbus 0x10 > /sys/bus/i2c/devices/i2c-0/new_device
fi

COUNTER=1
while [ $COUNTER -le 10 ]
do
IP=ifconfig eth0 | head -n 2 | tail -n 1 | sed s/inet\ addr:// | sed s/\ Bcast.*// | sed s/\ *//g
IP_CHECK=echo $IP | sed 's/\(\([0-9]\{1,3\}\)\.\)\{3\}\([0-9]\{1,3\}\)//g'
if [ “$IP_CHECK” != “” ]; then
IP=“No IP obtained”
sleep 1
else
COUNTER=11
fi
COUNTER=expr $COUNTER + 1
done

printf ‘\e[2J’ > /dev/ttyLCD0
printf “$IP” > /dev/ttyLCD0
printf “\n” > /dev/ttyLCD0
printf “Intel® FPGAs and Programmable Devices-Intel® FPGA” > /dev/ttyLCD0

Perfect! Thank you.

I started browsing the 13.02 BSP User Manual earlier (came up in a google search) but didn’t spend much time in it, instead I tried searching for a newer one thinking it might be a wild goose chase since I’m using 17.1. I’ll go back and see what I can glean from it.

And thanks for the script info too.

You’re welcome, good luck!

The script is most useful near the end where they give a few examples of the escape codes used to set the cursor to home, clear screen and so on

The post ‘Useful I2C from the HPS on the A10 SoC Devkit board’ shows how to make small Linux programs that can operate the LCD using I2C transactions. Apart from making I2C more approachable it can ease creating utilities that you can reuse in other Linux command line scripts.