12:52 pm
January 17, 2017
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
5:58 pm
January 17, 2017
6:40 pm
March 12, 2015
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.
40
1 Guest(s)