Page 4
4.3.7 RS485 Bus Test ..........28 4.3.8 USB Test ............29 4.3.9 RTC Test ............30 4.3.10 TF Card Test ..........31 4.3.11 LED Test ............32 4.3.12 Buzzer Test ........... 32 4.3.13 GPIO Test............32 4.3.14 Button Test ........... 33 4.3.15 Screen Capture Test ........
Page 5
Brief Introduction to Applications ......56 Compiling and Running Applications ......57 Common Functions ..........58 Linux Multi-Thread Programming ....... 59 6.10 Linux Network Programming ........61 6.11 Compiling Server ............ 64 6.12 Compiling Client ............64 6.13 Running Server and Client ........65 Chapter 7: Updating the Linux System ......
& developed by element14. It comprises of a 7” LCD display and touch screen assembly, integrated with multi-functional embedded hardware based on Atmel’s ARM9 AT91SAM9X35 industrial processor. The EDM6070AR-01 is a fully integrated Embedded Display Module solution for a variety of embedded control HMI applications, ready to drop into your product with negligible integration effort, OR to just wrap an enclosure around, add a software application and become your finished product.
Page 7
The Base Board expands the rich set of connectivity and user interface peripherals of the Atmel AT91SAM9X35 including Ethernet and CAN interface. The board also has a TFT touch screen LCD interface, USB hosts/device, Buzzer, RS232, RS485, Audio, GPIOs and an SD card interface to allow for large storage capabilities.
1.2 Kit Contents The EDM6070AR-01 SBC is packed with the items listed below: MINI6935 CPU Process Board based on AT91SAM9X35 MCU Expansion Base Board 7” Touchscreen LCD Display Product DVD/CD includes BSP, demo application & technical documentation.
Supports kernel and file system programming through U-Boot SAM-BA or USB flash drive (USB flash drive is recommended) Serial Debugging and COM2 serial interface on CPU Internal RTC of AT91SAM9X35 Ethernet 10/100M Ethernet driver Flash NAND Flash and DataFlash driver LCD driver, 800x480 resolution...
Types Names Description file systems Root File Readable and writeable file system, supporting UBIFS System compression storage 3.2 Example Applications The Linux system installed in EDM6070 contains multiple example applications under /home/app. Users can use those applications to implement, test or demonstrate various product functionalities. The following block diagram clearly shows the location of each example application in the system.
3.3 API Functions Before you start to test the product, it is necessary to learn about the API functions used by the example applications. If you need to understand the working principle of an application in detail, read the source code stored under “\02 Linux 2.6 Kit\01 Source Code\app\”...
Page 18
dev (character string of serial devices, e.g. “/dev/ttySAC0”) Parameters Values more than 0 is a serial file descriptor, less than 0 stands for failure Returned Values com_example.c void set_speed(int fd, int speed); Source com_example.c Functionalities Set the bitrate of serial interfaces fd (serial file descriptor) Parameters speed (bitrate, e.g.
Page 19
buf (pointer to the data about to be sent) nbytes (length of data about to be sent, Byte) Value of less than 0 stands for an error, more Returned Values than 0 stands for a data length being sent (Byte) int close(int fd);...
Page 20
ioctl(fd, GPIO_CLR_PIN, pin); Source gpio_example.c Allow the output pin to provide a low level Functionalities output Parameters Pin (GPIO pin name, such as GPIO_PD18) Returned Values None Page | 15...
Chapter 4: Demonstration and Test Functions This chapter will introduce to the Smart Home Automation demo application and how to use the example applications contained in the system to implement functionality tests of the EDM6070, as well as a demonstration of the LinuxQT graphics interface.
Video player Demo Features 4.1.1 This demo showcases the control of various house functions including heating, lighting, security and a media player. The major functions are expounded upon below: 4.1.1.1 Climate Control This application allows the user to control the temperature and humidity throughout the house on a room by room basis.
Page 23
5 day forecast Detailed current weather information Page | 18...
Page 24
Pulse-doppler radar weather display The weather information is updated via the internet and as such the EDM6070 requires an internet connection in order to provide this functionality 4.1.1.2 Lighting Control Page | 19...
Page 25
The lighting application allows the user to set the light levels in each room independently. The application emulates a standard dimmer switch making the software both intuitive and user friendly 4.1.1.3 Security The security application allows the EDM6070 to connect to cameras and door locks at any user defined entrance.
4.1.1.4 Media Player The Media application will allow the user to play audio into any connected room. The audio files can be streamed from internet radio, terrestrial / satellite radio or a local media server such as a PC or networked storage. Programming the demo 4.1.2 Follow the steps below to program the demo onto the EDM6070...
Page 27
3) Enable NAND Flash and disable Serial Flash according to the switch settings shown below: (refer to Figure 2: MINI6935 CPU Module (Front View) for the switch location) Figure 9: Switch Settings 1 4) Insert a MicroSD card into the MicroSD slot of the board, then power it up.
6) Turn the board on again and wait a few moments. The smart home demo UI should be displayed on the screen 4.2 System Setup Prior to commencing various features tests for EDM6070, you should first configure a HyperTerminal according to the parameters shown in the figure below;...
4.3 Testing Features Note: Each instruction has been proceeded by a pencil “ ” to prevent confusion caused by any long instructions that occupy more than one line in the context. Please note that there are SPACES in some of the following instructions; Missing any SPACE will lead to failure when running an application.
4.3.3 LCD Backlight Test 1) Execute the following instruction to adjust the backlight. The brightness value can be any integer from 1 to 10 inclusive. In this example the brightness has been set to 5 [root@Mini69X5:/]# bl_adjust SET 5 2)...
Note: The IP addresses above are only examples. Make sure the IP address of the EDM6070 is in the same network range as your PC. After all the settings are complete, execute a PING command to test the network connection.
CAN Bus Test 4.3.6 Connect your EDM6070 to another EDM6070 or a device with a CAN bus according to the figure shown below; Figure 12: CAN Bus Connection Note: The jumper JP13 in the figure shown above is shorted in order to enable 120R terminal resistor.
4.3.7 RS485 Bus Test The device corresponding to RS485 interface is /dev/ttyS0. Similar to the CAN bus test, the transceiving test over this bus needs another EDM6070 or RS485-enabled device; connect them according to the figure shown below; Figure 13: RS485 Bus Connection Note: ...
4.3.8 USB Test EDM6070 has a USB host interface. Upon inserting an USB flash drive into the EDM6070 USB port the HyperTerminal window will show information as follows; usb 1-1: USB disconnect, address 2 usb 1-1: new full speed USB device using at91_ohci and address usb 1-1: configuration #1 chosen from 1 choice scsi2 : SCSI emulation for USB Mass Storage devices scsi 2:0:0:0: Direct-Access...
2) Execute the following instruction to view the contents of the USB flash drive; root@Mini69X5:/mnt/usbhd-sda1]# ls 3) Execute the following instructions to un-mount the USB flash drive; [root@Mini69X5:/mnt/usbhd-sda1]# cd .. [root@Mini69X5:/mnt]# umount usbhd-sda1 RTC Test 4.3.9 RTC is used to store and recover the system clock. Follow the steps listed below to test the RTC;...
5) Execute the following instructions to update system clock with the clock information stored in RTC, and them view the system clock; [root@ Mini69X5:/]# hwclock -s [root@ Mini69X5:/]# date The updated system clock is shown below; Thu Nov 29 16:43:45 UTC 2013 Note: ...
4.3.11 LED Test EDM6070 has 2 LED indicators, among them the D2 is a system status LED. The following steps are the test for D1 (PB18) LED; 1) Execute the following instruction to test LED D1 by running an application; ...
[root@Mini69X5:/]# /home/app/gpio If the test is successful, the HyperTerminal window shows information as follows; --------------------------------------- * MINI69X5 GPIO Demo * --------------------------------------- GPIO_PB15 INPUT 1 GPIO_PD16 INPUT 1 GPIO_PD17 INPUT 1 GPIO_PD18 OUTPUT 0 GPIO_PD18 OUTPUT 0 GPIO_PD18 OUTPUT 0 GPIO_PD18 OUTPUT 0 4.3.14 Button Test Execute the following instruction to test the button SW1 on the EDM6070;...
Event: time 1167614678.630509, type 1 (Key), code 278 (BackBtn), value 1 Event: time 1167614678.630529, -------------- Report Sync ------------ Event: time 1167614678.826399, type 1 (Key), code 278 (BackBtn), value 0 Event: time 1167614678.826412, -------------- Report Sync ------------ Event: time 1167614679.430801, type 1 (Key), code 278 (BackBtn), value 1 Event: time 1167614679.430817, -------------- Report Sync ------------...
4.3.17 Watchdog Test Execute the following instruction to run the watchdog test program; [root@Mini69X5:/]# /home/app/watchdog The HyperTerminal window shows information as follows; Watchdog open success usage: [a] -- Feed dog [q] -- Quit without stop watchdog [e] -- Quit and stop watchdog 4.3.18 Telnet Test Connect EDM6070 to your LAN by using a RJ45 network cable, and then follow the steps listed below to implement the test;...
Page 41
Figure 14: Command Prompt Window 2) Type “ping 192.192.192.211” to test the network connection (the default IP address of the EDM6070 is 192.192.192.211) as shown below; Figure 15: Network Test After Completion 3) Type “telnet 192.192.192.211” to initiate a telnet session as shown below;...
Page 42
Figure 16: Telnet Session Initialization 4) Type the default username “root” and leave the password blank as shown below; Figure 17: Telnet Log In Now you have logged in to the telnet session successfully, to exit the session, type “exit”. Note: ...
4.3.19 Mounting NFS (Network File System) By mounting the NFS (Network File System), users can access the shared directory remotely under a Linux environment. Follow the steps listed below to test the NFS network file system; 1) Log in to the Linux system on your PC as a root user; 2)...
6) Execute the following instruction in the HyperTerminal window to mount the shared directory /home/nfs to /mnt [root@Mini69X5:/]# mount -o nolock 192.192.192.105:/home/nfs /mnt After mounting successfully, you can see the contents of the shared directory under /mnt. Note: EDM6070 has write permission to the shared directory, and therefore any changes will be saved.
Figure 19: File Selection Select a file to be sent and then click send; The HyperTerminal window shows information as follows; Starting xmodem transfer. Press Ctrl+C to cancel. Transferring dataflash_at91sam9g45ekes.bin... 100% 4 KB 0 KB/s 00:00:05 0 Errors [root@Mini69X5:/tmp]# The above information indicates that the file has been received successfully.
Page 46
1) Put the file to be sent in the HOME directory (e.g. G:\data.bin) and run tftpd.exe (this program can be found under “\02 Linux2.6 Kit\02 Tools\” in the CD-ROM) on your PC; Select Tftp > Configure on the menu bar of the program window, and set the path to Home Directory, and then select Tftp >...
Figure 20: Uploaded File The image shown above indicates a successful uploading. 4.6 Linux QT Demonstration When the system is under the shell interactive mode, you can start the Qtopia application by entering the command “qpe”. Then follow the steps listed below;...
Page 48
The QT interface and system information are shown below; Figure 21: Main QT Interface Figure 22: QT Interface Showing System Information Page | 43...
Chapter 5: Development Environment and System Compilation Before getting started with the development on the board, an ARM Linux cross development environment is required. This chapter will take Ubuntu as the example operating system to show you how to build a cross development environment and accomplish system compilation.
The HyperTerminal window shows information as follows; Using built-in specs. Target: arm-none-linux-gnueabi … gcc version 4.2.0 20070413 (prerelease) (CodeSourcery Sourcery G++ Lite 2007q1-10) If the version number within the last line is correct, the cross compilation environment has been built successfully. Note: ...
755 /usr/local/bin/mkyaffs2image /usr/local/bin/mkimage root@LINUXSERVER:~/embest# tar jxvf AT91Bootstrap-5series_1.2.tar.bz2 root@LINUXSERVER:~/embest# tar jxvf u-boot-at91sam9x35.tar.bz2 root@LINUXSERVER:~/embest# tar jxvf linux-2.6.39.tar.bz2 root@LINUXSERVER:~/embest# mkdir rfs; tar jxvf rootfs.tar.bz2 -C rfs Four directories - linux-2.6.39, u-boot-1.3.4, Bootstrap-v1.14 and rfs-qtopia have been generated under the current directory.
5.5 Making a U-boot Execute the following instructions to generate a u-boot; root@LINUXSERVER:~/embest/ u-boot-at91# make at91sam9x5ek_spiflash_config root@LINUXSERVER:~/embest/ u-boot-at91# make A file U-boot.bin has been generated under current directory. Note: An error might occur when using arm-2007q1-10-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 to compile u-boot;...
5.7 Making a File system Image Use the tool mkyaffs2image under the directory \02 Linux 2.6 Kit\02 Tools\ of the CD-ROM to make a file system image by executing the following instruction (suitable for Ubuntu systems only). root@LINUXSERVER:~/embest# mkubifsimage rfs rootfs.ubifs Page | 48...
Chapter 6: System Customization In order to satisfy different application requirements of the customers, designers need to make some customisation to the default configuration of the Linux kernel. This chapter will introduce the process of system customization by using some examples. 6.1 Kernel Customisation By default, the kernel source code provides a configuration file saved under arch/arm/configs/at91sam9x5ek_defconfig.
Page 55
Device drivers > Input device support > Keyboards > GPIO Buttons GPIO Device drivers > Misc devices > Device driver for Atmel GPIO devices Device drivers > LED Support > LED Class Support > LED Support for GPIO connected LEDs Device drivers >...
Drivers Paths Touch-Screen Input device support > Touchscreens > Atmel Touchscreen Interface Save the changes and execute the instruction below to compile the customized kernel; root@LINUXSERVER:~/embest/linux-2.6.24# make uImage 6.2 File system Customisation The table shown below lists the configuration files required for filesystem customisation, applications’...
LCD Backlight Brightness /etc/bl_adjust.conf User Testing Applications /home/app 6.3 Simple Driver Modules in Kernel Drivers are running under kernel mode and can drive hardware directly. They provide a series of interfaces to be called by applications so as to control devices. The table shown below is an example of driver modules that are simple but include most of the interfaces.
Page 58
*ppos) /* implement read operation */ int ret = copy_to_user (buffer, (char *)&result, sizeof(result)); copy the value of result to buffer */ if (ret < 0) { printk (KERN_ERR "%s: copy_to_user error\n", DEVICE_NAME); return -1; return sizeof(result); return valid length buffer, i.e.
Page 59
trigger the function */ int ret; ret = misc_register(&device_miscdev); /*register device */ if (ret) { printk(KERN_ERR "cannot register miscdev minor=%d (%d)\n", MISC_DYNAMIC_MINOR, ret); goto out; printk(KERN_INFO DEVICE_NAME " initialized!\n"); return 0; out: return ret; static void __exit device_exit(void) /* rmmod operation will trigger the function */ misc_deregister(&device_miscdev);...
6.4 Using Makefile to Associate Drivers with Kernel Driver files have to be associated with the kernel by a Makefile before they can be compiled and loaded. The following table shows the source code of the provided Makefile. # File: Makefile ifneq ($(KERNELRELEASE),) obj-m := device_drv.o # driver file with extension name .o...
demo removed! 6.6 Brief Introduction to Applications The previous example shows the execution process of drivers. You might notice that only two functions – device_init and device_exit have been called, while others remain unused in the above process. The interfaces in structure device_fops are intended for the application layer.
if (read (fd, &value, sizeof(value)) < 0) { read function that calls driver; the read value t is save in value */ fprintf (stderr, "read error\n"); err = 1; goto out; printf ("read before write, value=%X\n", value); /* print read value before writing */ int writeValue = 0x5E7F;...
The generated executable file named demo is the application we need; 2) Execute the following instruction to download it to the board; [root@Mini69X5:/]# insmod device_drv.ko System feedback is shown below; demo initialized! 3) Execute the following instruction to run the application; ...
Example functions Notes set PC16 as input, pull-up at91_set_gpio_input (AT91_PIN_PC16, disabled at91_get_gpio_value read the input value on PC16 (AT91_PIN_PC16); set PC16 to provide high-level at91_set_gpio_output(AT91_PIN_PC16, output 6.9 Linux Multi-Thread Programming The threads here refer to the multiple tasks created in the user space. These tasks share resources of the same process.
Page 65
int main(void) pthread_t reader, writer; /* define process ID pthread_mutex_init(&mutex, NULL); initiate mutex lock */ pthread_create(&reader, NULL, (void*)&read_func, NULL); create process */ pthread_create(&writer, NULL, (void*)&write_func, NULL); pthread_join(reader, NULL); /* wait for end of process */ pthread_join(writer, NULL); return 0; void write_func(void) while (1) { pthread_mutex_lock(&mutex);...
printf ("destroy item\n"); buffer_has_item = 0; pthread_mutex_unlock(&mutex); Execute the following instruction to implement the compilation. # arm-none-linux-gnueabi-gcc pthread.c -o pthread_demo -lpthread 6.10 Linux Network Programming Linux network programming generally can be implemented based on UDP and TCP protocols. UDP is a connectionless transport protocol that provides simple, unreliable and message-oriented services;...
Page 67
struct sockaddr_in their_addr; /* connector's address information */ int sin_size; if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { perror (" socket ") ; exit(1) ; my_addr.sin_family = AF_INET; my_addr.sin_port = htons(MYPORT); my_addr. sin_addr.s_addr = INADDR_ANY; /* auto-fill with local IP */ if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1) perror ("...
Page 68
while(waitpid(-1,NULL,WNOHANG) > 0); /* clean up child processes */ Client: Initiates a connection to the server, receives and prints information sent from the server. /* File: client.c */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <netdb.h> #include <sys/types.h> #include <netinet/in.h>...
# arm-none-linux-gnueabi-gcc client.c -o client Running Server and Client 6.13 In the event that two EDM6070s are to be run in a client/server pair, download the EDM6070-based server and the client programs to these boards respectively, and then run the server by executing the following instruction;...
Chapter 7: Updating the Linux System EDM6070 has a Serial Flash and a NAND Flash on board. But the Linux system can only support boot-up from Serial Flash currently. This chapter will introduce in detail how to update the Linux system stored in Serial Flash. 7.1 Images and the Programming Tool The following two figures illustrate how the images are distributed in Serial Flash and NAND Flash.
0x10000000 Share 0x07A00000 UBIFS 0x00C00000 RAMDisk 0x00600000 uImage 0x00000000 Figure 24: Images in NAND Flash SAM-BA_2.12.exe "\02 Linux2.6 Kit\02 Install saved under Tools\SAM-BA" CD-ROM well patch sam-ba_2.12_patch2a.exe. After installation is done, a shortcut icon for SAM-BA v2.12 can be found on the desktop of your PC as shown below; Figure 25: SAM-BA Shortcut 7.1.1 Programming System Image Automatically...
Page 73
EDM6070 to complete the process. (Images are saved under 02 Linux 2.6 Kit\00 Image of the CD-ROM) The table shown blow contains the images required. Categories Names Ways to Make Images boot.bin By using tools Tool Images uboot.bin By using tools System image, by renaming strap.bin at91sam9x5ek-dataflashcardboot-3.1.bin...
7.1.2 Programming System Image Manually Follow the steps listed below to program a system image manually. 7.2 Preparations 1) Connect the debugging serial interface of EDM6070 to your PC’s serial interface using a female-to-female cross-over serial cable and a serial interface adapter; 2)...
Page 75
Select at91sam9x35-ek in Select your board drop-down menu and then click Connect; 6) Enable both Serial Flash and NAND Flash according to the switch settings shown below; (refer to Figure 2: MINI6935 CPU Module (Front View) for the switch location: Figure 28: Switch Settings 2 7)...
8) Select Erase All in the Scripts drop-down menu and then click Execute to erase all the contents in Serial Flash as shown below; Figure 30: Erasing Serial Flash 7.3 Programming Image Files 1) Select Send Boot File in the Scripts drop-down menu of SAM-BA’s main window and then click Execute to open the following window;...
Page 77
Select strap.bin (the at91sam9x5ek-dataflashcardboot-3.1.bin file generated in section 5.4), and click Open to download it to Serial Flash; 2) Enter an address 0x8400 in Address text box of SAM-BA’s main window and click located to the right of the Send File Name text box to open the following window;...
Page 78
Figure 33: Enabling NAND Flash 4) Select Enable OS PMECC parameters in the Script drop-down menu and then click Execute to open the following window; Figure 34: ECC Configuration Settings Check Trimffs check-box and keep the rest of options unchanged, and then click OK;...
Page 79
Figure 35: Erasing NAND Flash 6) Enter an address 0x0 in Address text box and click on the right of Send File Name text box to open the following window; Figure 36: Selection of uImage Select uImage file and click Open, and then click Send File in SAM-BA main window to download it to NAND Flash;...
Page 80
7) Enter an address 0xc00000 in Address text box and click the right of the Send File Name text box to open the following window; Figure 37: Selection of rootfs.bin Select rootfs.bin file and click Open, and then click Send File in SAM-BA main window to download it to NAND Flash;...
Need help?
Do you have a question about the AT91SAM9X35 and is the answer not in the manual?
Questions and answers