How to use SPI slave within U-Boot?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use SPI slave within U-Boot?

Jump to solution
3,544 Views
chris_f
Contributor V

I'm trying to initialise an LCD over SPI within U-Boot on an i.MX6ULLEVK. Can someone point me at some relevant U-Boot examples of setting up and using an SPI slave?

0 Kudos
1 Solution
1,984 Views
chris_f
Contributor V

It's fairly simple once you find the file you need to edit! If like me you're new to Yocto then that in itself is a challenge. As far as I can make out, all of the u-boot board specific code for the i.MX6ULLEVK is in:

build/tmp/work/imx6ull14x14evk-poky-linux-gnueabi/u-boot-imx/2016.03-r0/git/board/freescale/mx6ullevk/mx6ullevk.c


I couldn't find any helpful spi libraries in the u-boot code - I think there might be some there but even the int enable_spi_clk(unsigned char enable, unsigned spi_num); failed to link with object not found so I figured I was on my own with the reference manual.

The attached patch adds a hacked in spi lcd initialisation (note the LCD in question uses 9-bit transfers) to the do_enable_parallel_lcd function.

If you're using an i.MX6ULBB you'll also need to remove resistors R1633 (hidden next to the SOM), R1634, R1635 and R1636 (all hidden on the back of the board) and fit 0R in R907,R908,R910 and R911 (hidden next to R1633).

View solution in original post

2 Replies
1,985 Views
chris_f
Contributor V

It's fairly simple once you find the file you need to edit! If like me you're new to Yocto then that in itself is a challenge. As far as I can make out, all of the u-boot board specific code for the i.MX6ULLEVK is in:

build/tmp/work/imx6ull14x14evk-poky-linux-gnueabi/u-boot-imx/2016.03-r0/git/board/freescale/mx6ullevk/mx6ullevk.c


I couldn't find any helpful spi libraries in the u-boot code - I think there might be some there but even the int enable_spi_clk(unsigned char enable, unsigned spi_num); failed to link with object not found so I figured I was on my own with the reference manual.

The attached patch adds a hacked in spi lcd initialisation (note the LCD in question uses 9-bit transfers) to the do_enable_parallel_lcd function.

If you're using an i.MX6ULBB you'll also need to remove resistors R1633 (hidden next to the SOM), R1634, R1635 and R1636 (all hidden on the back of the board) and fit 0R in R907,R908,R910 and R911 (hidden next to R1633).

1,984 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Chris,

Thanks for sharing your solution with the Community! As you mentioned, SPI driver is already included on the U-boot sources, so, you need to modify it according to your application requirements.

Best regards!

/Carlos

0 Kudos