I2C Slave Examples on the TSX PWS board | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
I2C Slave Examples on the TSX PWS board
March 22, 2018
12:52 pm
Avatar
SimonCee
Member
Members
Forum Posts: 10
Member Since:
January 17, 2017
sp_UserOfflineSmall Offline

I'm writing an I2C slave emulation of a temperature sensor that I want to work with and I've used the I2C Slave example as a baseline and installed it on the PWS using LV for Arduino.  I've changed the address of the slave to match my target device and connected the master device. 

When I run the example the main VI appears to run but no characters are displayed on the serial port other than a start-up string that I've added to the main VI.  However, when my main VI stops a stream of garbage characters are sent to the serial port.  If I disconnect the I2C bus from the master the garbage continues and I can only stop it if I hard reset the board.  I've tested the serial port all speeds (I'd like to run it at 57600 baud) and the behaviour persists.

Does anyone have any suggestions as to the cause or has anyone experience of setting up the I2C slave function.

I'm also interested in finding out how to disable to slave VI callback when I terminate the program as it would, if I'm right, continue to operate even if the main VI has run to completion.

I've attached my VIs here.

Any help would be much appreciated.

Regards

SimonC

March 22, 2018
5:39 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Can you save your VIs for LV2015 and I can take a look?  Usually behavior like this may indicate a memory leak or memory overrun.

March 22, 2018
5:58 pm
Avatar
SimonCee
Member
Members
Forum Posts: 10
Member Since:
January 17, 2017
sp_UserOfflineSmall Offline

I think I've done this right Steffan.  Files attached.

March 22, 2018
6:40 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

I don't see any glaring issues with your I2C code but I was able to run this on a Due (although without a master connected) but don't see your issue with random characters when the stop button is pressed.  Here are some suggestions:

1) You have the input for the button configured as an Input instead of Input Pullup.  Not sure how this is wired on the PWS but usually this would result in a floating input unless the hardware has an external pullup.  I had to change it to run on the Due.

2) Do you have another board to run on?  Might be a good idea to run it on a standard Arduino board to see if it is a hardware issue.  You may want to get in touch with the manufacturer of the PWS board.

3) I would double check your slave address.  This always trips people up.  You have to take into consideration a bit shift to account for the low bit read/write bit.

4) You can try running the shipped example as is with another arduino as the master.  This example as been completely verified on the supported Arduino boards.  This would help confirm that your board is functioning.

5) Keep in mind that even though you stop the main loop, in the background the Arduino is still running.  This means that your interrupt handler will still be running and processing interrupts.

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
40
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356