Project

General

Profile

Software FAQs

How can I get a simple "Hello World" web application running on a MitySOM 335x?

The MitySOM 335x comes with a lightweight, powerful web server, lighttpd, already pre-installed. Unfortunately, the MitySOM is currently set up to only use that web server on port 8080, and another web server that is even more lightweight and simple (thttpd) is serving on the default http port 80. Because of this, we recommend you disable thttpd in order to avoid confusion. Generally, there is no need to have more than one web server running at once.

To disable thttpd, enter the following commands to first navigate to the /etc/init.d directory, then to remove thttpd from automatic startup:

cd /etc/init.d
update-rc.d -f thttpd remove

Next, you'll want to change the configuration of lighttpd. By default, it serves up its web files from the "matrix gui" demo folder at /usr/share/matrix-gui-2.0. Rather than this demo, you want to have lighttpd serve up your web app. You can put your web files in any directory you'd like, although a common default is /var/www.

Rather than editing the config file by hand, we have provided a pre-edited config file for you to use. Simply download lighttpd.conf, then copy it to the correct directory on your MitySOM. If you are using a linux PC, you can use the scp command from a terminal session to copy the file (insert the IP address of your MitySOM in place of MITYSOM_ADDRESS):

scp lighttpd.conf root@MITYSOM_ADDRESS:/etc

On Windows, there is an excellent utility called WinSCP that can be used to easily copy files in a graphical manner. No matter which option you choose, your goal is to put the lighttpd.conf file from this wiki into the /etc/ directory of your MitySOM's filesystem. Use a text editor like notepad or gedit to change line 43 of the lighttpd.conf file before you copy it over to your MitySOM if you want to use a directory other than /var/www for your web application files.

Assuming you left the defaults of /var/www as your web directory, you'll need to actually create the www directory first. On your MitySOM, enter:

cd /var
mkdir www

Now download the simple example index.php file and copy it onto your MitySOM to /var/www. You'll do this just like you did before, using scp on linux, or WinSCP on Windows.

scp index.php root@MITYSOM_ADDRESS:/var/www

Now reboot your MitySOM to make sure your changes have been applied and the web server is started with your new configuration. Once it boots up, you should see a full-screen web application that has all sorts of information regarding the install of PHP (this is the standard output from the phpinfo() script). You will see the same thing on a PC web browser as well. From a PC, navigate to: http://MITYSOM_ADDRESS:8080/ (again, replace MITYSOM_ADDRESS with the actual IP address of your MitySOM). On a PC, you should see a page that looks like this: WebServerTest.png. It is important to note that the web server on the MitySOM is serving on port 8080, not the default port 80. This means that whenever you access web pages served by your MitySOM on a PC, you need to have the :8080 designation after the ip address (e.g. http://192.168.1.2:8080).

This simple demo shows that your web server is working properly, as well as your install of PHP. It also gives some valuable information about the PHP install in case you need to make any changes to the PHP configuration. If your web application needs other technologies or scripting languages, such as Python or Perl, these are available on MitySOM but may not be set up by default. Please contact Critical Link for more information.

My Ethernet is not working and ifconfig -a does not show eth0?

If the file system is copied from another AM335X (or a central repository) the udev rules can get confused (udev is the system daemon responsible for hardware configuration) as it has recorded the MAC address of the Ethernet interface (so eth0 is the same interface every time). Remove the file
/etc/udev/rules.d/70-persistent-net.rules and reboot. udev will re-create the file with the correct MAC address. It is possible (via the rules and scripts files) to configure udev in a multitude of ways, but that is left as an exercise for the reader :)
Here is one (of many) link about udev http://glen.alkohol.ee/pld/wiki/Docs(2f)UdevFAQ.html

Note: /etc/udev/rules.d/70-persistent-net.rules file can be setup to always set the network to eth0

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" 

U-boot has started hanging on startup while booting from nand or is behaving unusual

You might see something similar to the following:

U-Boot SPL 2011.09 (May 28 2013 - 15:41:49)
Texas Instruments Revision detection unimplemented
PLL configuration complete

U-Boot 2011.09 (May 28 2013 - 15:41:49)

I2C:   ready
DRAM:  256 MiB
WARNING: Caches not enabled
NAND:  HW ECC Hamming Code selected
256 MiB
MMC:   OMAP SD/MMC: 0
Net:   cpsw
Hit any key to stop autoboot:  0

There exists a problem with the 2011.09 version of U-boot in which the UBL isn't enabling ecc when it reads the u-boot.img from nand. This meant that when bitflips occurred in this location in nand they were not being corrected. Depending on where the bitflips occur you can see any number of odd issues.

To confirm this is your problem:
  • Create a dev kit sd card Creating_an_SD_Card
  • Boot into u-boot from the sd card. Should be running 2013.10 or newer version of u-boot.
  • Run the following commands to read the UBL, u-boot, and kernel to see if any bitflips are detected.
    U-Boot# nand read $loadaddr 0x0 0x80000
    
    NAND read: device 0 offset 0x0, size 0x80000
     524288 bytes read: OK
    U-Boot# nand read $loadaddr 0x80000 0x1e0000
    
    NAND read: device 0 offset 0x80000, size 0x1e0000
    Fixing bitflip at location 185
     1966080 bytes read: OK
    U-Boot# nand read $loadaddr 0x280000 0x500000
    
    NAND read: device 0 offset 0x280000, size 0x500000
    Fixing bitflip at location 185
    Fixing bitflip at location 185
    Fixing bitflip at location b8
     5242880 bytes read: OK
    

    In the above example bit flips are found in u-boot and in the kernel image, but the ecc was able to correct them. The 256MB nand uses bch-8 which is able to correct upto 8 bits per 512B (1). So the number of bit flips in the u-boot image is easily within the correctable range and is still in normal operating condition.
  • To Test from linux

Solution:
Updating to the latest 2013.10 u-boot which does use the ecc when reading the u-boot.img will correct this problem.

Forum Reference:
https://support.criticallink.com/redmine/boards/28/topics/3919

How do I use i2cdetect?

When I use i2cdetect I get the following error:

root@mityarm-335x ~ $ i2cdetect -y 1
Error: Can't use SMBus Quick Write command on this bus

The 335x doesn't support the SMBus Quick Write feature. You need to pass the -r option to get it to work.

root@mityarm-335x ~ $ i2cdetect -r 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@mityarm-335x ~ $ i2cdetect -r 2
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- 12 -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@mityarm-335x ~ $ i2cdetect -r 3
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-3 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

How can I read the part number of the module?

The part number of the module can be read from the eeprom using the i2c bus. Issue the following command to get the contents of the eeprom. NOTE: Do NOT try to write to this. It may result in overwriting the eeprom which will render the device unable to boot.

cat /sys/bus/i2c/devices/2-0050/eeprom

Useful memory locations

AM335x TRM - Table 2-3: Peripheral Memory Map
http://www.ti.com/lit/ug/spruh73q/spruh73q.pdf

  • Gpio
    GPIO base address: 0x4804_C000
    AM335x TRM - Table 23-5: GPIO Registers
  • Control Module
    Control Module base address: 0x44E1_0000
    AM335x TRM - Table 9-10: CONTROL_MODULE REGISTERS
    • Pinmux start address: 0x44E1_0800
      AM335x TRM - Section 9.3.1.50: conf_<module>_<pin> Register
  • Boot ROM Tracing
    AM335x TRM - Section 26.1.14 Tracing
    http://processors.wiki.ti.com/index.php/AM335x_board_bringup_tips#Tracing_vectors
    0x4030CE40 Current tracing vector, word 1
    0x4030CE44 Current tracing vector, word 2
    0x4030CE48 Current tracing vector, word 3
    0x4030CE4C Current copy of the PRM_RSTST register (reset reasons)
  • LCD Controller
    LCD Controller base address: 0x4830_E000
    AM335x TRM - Table 13-13: LCD Registers

Analyzing Boot Issues with CCS and JTAG

http://processors.wiki.ti.com/index.php/AM335x_board_bringup_tips#Analyzing_Boot_Issues_with_CCS_and_JTAG
Zip file archive of the TI wiki
Using a DSS script for CCS you can easily parse some of the important register details into easily digestible info.

  • Download am335x-boot.dss
  • Launch CCS.
  • Create an appropriate target configuration file for connecting to your board.
    • File -> New -> Target Configuration File
    • Supply a name/location for the file.
    • View -> Target Configurations to see the available target configurations (yours should now be among them!).
    • Double-click your file in the Target Configurations panel to open it for editing.
    • Select your emulator and processor. Save.
  • Launch the debugger, but do not connect to any CPUs.
    • In the Target Configurations window, right-click on your ccxml file and select "Launch Selected Configuration"
  • Launch the scripting console by going to View -> Scripting Console.
  • Load am335x-boot.dss in the scripting console by executing "loadJSFile <path-to-dss-file>/am335x-boot.dss".
  • It will generate a am335x-boot-analysis_yyyy-mm-dd_hhmmss.txt file on your desktop that can be used for quick analysis.

Fix "ssh deprecated" support to 335x dropbear old algorithms

On Ubuntu PC or VM:

  • sudo vi /etc/ssh/ssh_config
  • Add the following lines to the end
    #   Enable less secure algorithms and ciphers to support 335x dropbear
        KexAlgorithms +diffie-hellman-group1-sha1
        Ciphers +aes128-cbc
    
  • sudo vi /etc/ssh/sshd_config
  • Add the following lines to the end
    # Enable less secure algorithms and ciphers to support 335x dropbear
    KexAlgorithms +diffie-hellman-group1-sha1
    Ciphers +aes128-cbc
    

Go to top
Add picture from clipboard (Maximum size: 600 MB)