SC20-GPIO, UART and I2C Test

Hi,

We are trying to interface the external peripherals to the SC20 Smart EVB kit with Android Version 7.1.2 SDK. We are facing problem when we are trying to test GPIO, UART with demo app. We are getting a error stating “/dev/ttyHSL0 Open Failure!” for UART and “Error: Value read numerical failure” for GPIO. We also need the demo apk to test I2C. Please do revert back with the solution and provide a link to the demo apk to test the I2C at the earliest.

Thanks in Advance,

the errors maybe caused by permission.
So you need change the permission of the device node and the selinux.

For I2C, you can use the i2c interfaces in user space.

set permission for /dev/ttyHSL0 in

  1. add following lines in device/qcom/common/rootdir/etc/init.qcom.rc
    chmod 0777 /dev/ttyHSL0
    chown root root /dev/ttyHSL0

Hi,

Thanks for your response @jax.zhang.

  1. UART: We have provided the permissions using chmod 0666 in the init.qcom.rc as shown in the attachment(labeled as 1). Even after providing the permission, the below highlighted error in attachment( labeled as 2) was observed on the Debug UART while trying to access the port on the demo apk.
  2. GPIO: We are getting the error as observed, in the attachment(labeled as 3). Please help us in solving this error.
    NOTE: If any particular permissions for accessing GPIO is required, please do let us know with steps to get the GPIO working.
  3. I2C: We would request you to provide more details or link, where we could find the steps to implement the I2C in standard user interface. Any example of how to test the I2C would be helpful.

Thanks,

yes, you need modify the selinux to allow the application to control the uart and gpio.

for i2c, you can reference to the attachment.
it show you how to control a device with addr 0x50 on the i2c-3

Hi,
Thanks for the quick response @jax.zhang .

  1. Could you please let us know, how we can modify the selinux to allow the application to control the uart and gpio in a detailed manner.
  2. Regarding I2C, I would like to know where exactly the attached part needs to be added in the SDK(i.e. path where we need to add the testi2c.c file).

Thanks,

Hi,
By modifying the permission, now UART and GPIO are working. We request you to provide us more details on how we can get the I2C working in the user space (Please do provide the detailed steps on how we can check the I2C code provided by you in the previous post using user space). Please do revert back asap.

Thanks,

Hi,
As I am new to this platform, I need some help to get the I2C working. I would be thankful if anyone can help, on how I can test the I2C in user-space. I would also like to get any kind of link for any demo I2C android app, where I can check the I2C for SC20.

Thanks,

hi,
Some patch and demo tests have been completed.
Can you tell me which function you want to test.
Such as when you want test I2c, You need to know the i2c address you need to communicate with.
So please give me more detail information and I will give you the demo.

Hi,
We are also testing i2c. connected to Lontium LT8912B. Device address is 0x48. We are testing using “./i2ctest -B <i2c_bus_number> -S <i2c_slave_addr> -W <i2c_write_data> -R <i2c_read_dat
a_len>” , But if we want to read or write specific register how can we do it.

Do you know the i2c-tools?you can use that?

Thank you for immediate reply.
Actually we are new to sc20. We don’t know about how to use i2c tools.

Hi!

Please tell me, is there some kind of demo for the protocol? Suppose I connected a device to some i2c, how can I work with it now?

Thank you!

Hi, I2c_tools is a good example, and here’s the download link.
git clone https://github.com/suapapa/i2c-tools.git