LCD RGB Display Illegal instruction

I’m trying to use the C sdk wrapped with Swift and I keep getting Illegal instruction when ever I try to set the text on the screen.

Hi @jus0610tin,

Can you share more details about the code that you are using and the output that you are getting. Also can you try this example to make sure the LCD Display works.

Are you using the Raspbian for Robots Image or any other image on your Pi?

-Shoban

I’m using the LCD RGB one but the python works fine.

I’m using this code with this wrapper
https://gist.github.com/anonymous/86b10054fd9f528cdb0d22e05dd54fa5

var screen = GrovePiLCDRGB(color: RGBColor(red: 100, green: 100, blue: 100)) screen.clearDisplay() screen.setText(string: "Hello")

Hi @Shoban,

The error is happening when I call i2c_smbus_write_byte_data(addr,cmd,value);
with 0x62, 0x08, 0xaa

Hi @jus0610tin,

It looks like the code is, probably failing to send the I2C data to the LCD. We haven’t tried it with swift so it is new to us too. Can you tell us where i2c_smbus_write_byte_data(addr,cmd,value) function is defined here and you can look into the implementation of the function to find the problem.

-Shoban

Hi @Shoban

https://github.com/jay18001/GrovePiTests Here’s the project

That function is defined here https://github.com/jay18001/GrovePiTests/blob/master/Dependencies/GrovePi/CGrovePi/grovepi.c#L88

also as a side note I used this guide to install swift
http://dev.iachieved.it/iachievedit/swift-3-0-on-raspberry-pi-2-and-3/

Hi @jus0610tin,

Thanks for sharing the code. Not very sure of the problem. We’ll give a shot to the code that you have sent, in swift and see if it works for us.

-Shoban

Hi @Shoban

I found the Illegal instruction is an int overflow. There was also another problem with the write_byte_data(char addr, char cmd, char vlaue) method where it needed to call ioctl(fd, I2C_SLAVE, newAddress); The swift code it working now if you guys want to play with it.

Hi @jus0610tin,

Glad to hear, you have it working. Can you tell us if the swift code which you have working, is from this repository. Also if you have any links to get started with swift on Pi, can you share it with us.

Thanks,
-Shoban

Hi @Shoban,

Here’a a quick guide on installation and testing on Raspbian
https://gist.github.com/jay18001/3678f8e9ba8859f443a8785340a99fb9

Yes, I updated the code in that repository. To build and run, run make all and then ./build/grovepitests

Here is a medium article on using swift on the pi
https://medium.com/a-swift-misadventure/installing-swift-3-0-preview-on-a-raspberry-pi-2-3-with-raspbian-3e857fa995d9#.rts79o75f

Hi @jus0610tin

Thanks a lot for sharing, we will look into it.

-Shoban