- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi.
I have an LCD with a ILI9341 controller connected to Intel Edison Breakout Board. Both based on custom PCB. Pins used to connect display are:
MRAA 9 (GP111, SPI_2_FS1)
MRAA 45 (GP45)
MRAA 32 (GP46)
MRAA 33 (GP48)
It runs on default Yocto with 3.10.17
UPM/MRAA example ili9341.cxx (https://github.com/intel-iot-devkit/upm/blob/master/examples/c%2B%2B/ili9341.cxx https://github.com/intel-iot-devkit/upm/blob/master/examples/c%2B%2B/ili9341.cxx) doesn't work, saying pin GP111 is already busy.
It is really busy:
cat /sys/kernel/debug/gpioGPIOs 0-191, pci/0000:00:0c.0, 0000:00:0c.0:
gpio-41 (sysfs ) in lo gpio-45 (sysfs ) out hi gpio-46 (sysfs ) out hi gpio-48 (sysfs ) out hi gpio-49 (sysfs ) out lo gpio-61 (SW1UI4 ) in hi gpio-64 (bcm43xx_irq ) in hi gpio-71 (bcm_bt_lpm ) out lo gpio-77 (sd_cd ) in hi gpio-96 (vwlan ) out higpio-111 (Arduino Shield SS ) out hi <-------- busy pin gpio-124 (hsu ) in hi gpio-125 (hsu ) in hi gpio-126 (hsu ) in hi gpio-127 (hsu ) in hi gpio-128 (hsu ) in lo gpio-129 (hsu ) in hi gpio-130 (hsu ) in hi gpio-131 (hsu ) in hi gpio-132 (hsu ) in lo gpio-133 (hsu ) out lo gpio-134 (hsu ) in hi gpio-184 (bcm_bt_lpm ) out lo gpio-185 (bcm_bt_lpm ) in lo
Then I found who uses it in kernel. Here it is:
linux/arch/x86/platform/intel-mid/device_libs/platform_spidev.c
in menuconfig its CONFIG_SPI_INTEL_MID_SSP
Description from menuconfig:
This is the unified SSP SPI slave controller driver for the Intel │ │ MID platforms (Moorestown, Medfield, Clovertrial and │ │ Merrifield), primarily used to implement a SPI host controller ││ driver over a SSP host controller
If I disable this driver - I can't find any spi device in kernel then.
And upm/mraa example says:
root@edison:~/upm/examples/c++# ./ili9341
terminate called after throwing an instance of 'std::invalid_argument'
what(): Error initialising SPI bus
Aborted
So how to handle this issue?
Should I connect LCD to another chip-select, GP110? Would it help? Or there is some way to use chip-select pin GP111?
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
Yes, if you disable it on the menuconfig it will not be included on the image; this will not let you use the SPI interface at all.
I suggest you to use another GPIO, there have been some problems reported by other makers/developers related to the CS0, as you have seen there are some threads regarding the CS0:
For example: https://communities.intel.com/message/347024# 347024 https://communities.intel.com/message/347024# 347024, the CS0 is supposed to be connected to the ADC in the Arduino Expansion Board so you could use another GPIO for the approach you need.
If you want to modify the functionality of the CS0 or the GPIO111 and use MRAA you can try by modifying the https://github.com/intel-iot-devkit/mraa/blob/master/src/x86/intel_edison_fab_c.c https://github.com/intel-iot-devkit/mraa/blob/master/src/x86/intel_edison_fab_c.c and build again the library so you could use these changes on your custom image.
I suggest you to use another free GPIO as a CS, so you can avoid other problems with different GPIOs in the image and libraries.
Take a look at the GPIOs and their functionalities.
http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonarduino_hg_331191007.pdf http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonarduino_hg_331191007.pdf
http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonmodule_hg_331189004.pdf http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonmodule_hg_331189004.pdf
https://github.com/intel-iot-devkit/mraa/blob/master/docs/edison.md https://github.com/intel-iot-devkit/mraa/blob/master/docs/edison.md
Regards,
Charlie
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Ok, actually it looks like SPI CS0 problem.
Also is there any common way to set CS0 free by modifying the kernel?
The only way I found is that patch (didn't test yet):
https://gist.github.com/FantomJAC/69c3e963580e939b0615 Enable SPI CS0 (spidev5.0) on Intel Edison · GitHub
also as I said above by disabling CONFIG_SPI_INTEL_MID_SSP I don't have any spi device detected at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
Yes, if you disable it on the menuconfig it will not be included on the image; this will not let you use the SPI interface at all.
I suggest you to use another GPIO, there have been some problems reported by other makers/developers related to the CS0, as you have seen there are some threads regarding the CS0:
For example: https://communities.intel.com/message/347024# 347024 https://communities.intel.com/message/347024# 347024, the CS0 is supposed to be connected to the ADC in the Arduino Expansion Board so you could use another GPIO for the approach you need.
If you want to modify the functionality of the CS0 or the GPIO111 and use MRAA you can try by modifying the https://github.com/intel-iot-devkit/mraa/blob/master/src/x86/intel_edison_fab_c.c https://github.com/intel-iot-devkit/mraa/blob/master/src/x86/intel_edison_fab_c.c and build again the library so you could use these changes on your custom image.
I suggest you to use another free GPIO as a CS, so you can avoid other problems with different GPIOs in the image and libraries.
Take a look at the GPIOs and their functionalities.
http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonarduino_hg_331191007.pdf http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonarduino_hg_331191007.pdf
http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonmodule_hg_331189004.pdf http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonmodule_hg_331189004.pdf
https://github.com/intel-iot-devkit/mraa/blob/master/docs/edison.md https://github.com/intel-iot-devkit/mraa/blob/master/docs/edison.md
Regards,
Charlie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi. Thanks for the answer.
I used mraa just for testing. I understand it works in userspace via spidev. I also know that spidev is half-duplex char device driver and if I want to achieve some speed I should avoid use it and use spi master-slave behaviour. I need to run X on display and redraw screen fast enough, so I hope to make it work at 25MHz via spi with dma. (notro fbtft driver will be used). To achieve such a functionality it seems the only way would be to connect this display to CS with pin 110. Is that correct? Also what If I want to have 2 spi devices : display and some analog-digital converter (like AD7791). How should I connect them both if there are only 1 chip-select pin left?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
If you remove spidev, GPIO111/FS1 should be free. Then you'll be able to install fbtft and use FS1 to work with it.
You'll be able to use FS0 for an ADC.
I don't know what is the best way to disable spidev.
Probably, somewhere here, in board.c: edison-src/build/tmp/work/edison-poky-linux/linux-yocto/3.10.17-r0/linux/arch/x86/platform/intel-mid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
Yes I would suggest you to use another GPIO as you mentioned. If you want to use different devices. You can program other GPIOs to work as a CS.
Regards,
Charlie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
You should use a general GPIO for CS like GPIO44, not one of the specialized SPI CS pins FS0 and FS1.
Here is an explanation.
In Linux, there are kernel space drivers and user space programs.
mraa is run in the user space. So, it needs a proxy to connect to the SPI bus in the kernel space. This proxy is spidev.
spidev is run in the kernel space as an SPI kernel driver and it uses the FS1 pin.
You can disable spidev, then create and load a kernel module for your LCD.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page