- Netduino Forums
- → teo's Content
teo's Content
There have been 12 items by teo (Search limited from 29-March 23)
#41283 Nokia 3110/LCD4884 JoyStick
Posted by teo on 09 December 2012 - 09:52 PM in Netduino Plus 2 (and Netduino Plus 1)
#27793 Multiple I2C devices
Posted by teo on 21 April 2012 - 07:48 AM in Netduino 2 (and Netduino 1)
#27788 Multiple I2C devices
Posted by teo on 21 April 2012 - 05:56 AM in Netduino 2 (and Netduino 1)
However, the readings I got back are not quite expected. Can you please check the implemention, especially this line:
device.ReadInternalAddressBytes(i2cconf2, rbuf, 27, 8);I am trying to read 8 registers from one of the devices, starting from register number 27 (or 0x1B). Is this the right way to do it?
#27694 Multiple I2C devices
Posted by teo on 20 April 2012 - 07:02 AM in Netduino 2 (and Netduino 1)
#27600 Multiple I2C devices
Posted by teo on 18 April 2012 - 11:13 PM in Netduino 2 (and Netduino 1)
I tried to use your driver and I can't seem to get it to work. An exception pops up. Odds are, I have used your code the wrong way.
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) #### #### Message: #### Netduino.Extender.TransferAdapters.I2CAdapter::ModifyToRepeatedStartTransaction [IP: 0013] #### #### Netduino.Extender.TransferAdapters.I2CAdapter::CreateInternalAddressReadTransaction [IP: 0013] #### #### Netduino.Extender.TransferAdapters.I2CAdapter::ReadInternalAddressBytes [IP: 000a] #### #### NetduinoPlusApplication1.Program::Main [IP: 003a] ####
Can you please see the following code? I have 3 I2C devices on the bus, and I am just trying to read one of them (device_addr = 104) in an infinite loop. The internal registers to read from is 27 to 34 (8 registers to read).
public static void Main() { I2CAdapter device = I2CAdapter.Instance; I2CDevice.Configuration i2cconf1 = new I2CDevice.Configuration(83, 400);//accl I2CDevice.Configuration i2cconf2 = new I2CDevice.Configuration(104, 400);//gyro I2CDevice.Configuration i2cconf3 = new I2CDevice.Configuration(30, 400);//mag byte[] rbuf = new byte[8]; while (true) { device.ReadInternalAddressBytes(i2cconf2, rbuf, 27, 8); Debug.Print("");//print results to debug window here Thread.Sleep(500); } }
Thanks for taking the time!
#27565 Grove - 3-axis Gyro I2C problem
Posted by teo on 18 April 2012 - 05:15 PM in Netduino 2 (and Netduino 1)
Looking t the datasheet there is no mention of the module supplying it's own pull up resistors. It is also not clear from the photograph how the module is connected to the Netduino. So I'd consider investigating this.
regards,
Mark
According to the schematic of the module, there are 10k pullups on the bus, before and after the 3v3/5v level-shifter.
#27512 Grove - 3-axis Gyro I2C problem
Posted by teo on 18 April 2012 - 01:29 AM in Netduino 2 (and Netduino 1)
gyro.WriteToRegister(0x17, 0x01);Looking at the photograph, the interrupt line is not connected to the netduino. (I don't think that's the source of your problem, though.)
#27483 Grove - 3-axis Gyro I2C problem
Posted by teo on 17 April 2012 - 08:21 PM in Netduino 2 (and Netduino 1)
#27123 Multiple I2C devices
Posted by teo on 13 April 2012 - 12:47 AM in Netduino 2 (and Netduino 1)
#27083 Multiple I2C devices
Posted by teo on 12 April 2012 - 05:16 PM in Netduino 2 (and Netduino 1)
I2CDevice.Configuration Myconfig = new I2CDevice.Configuration(addr, clkrate); I2CDevice MyI2Cdevice= new I2CDevice(Myconfig); // create the transaction and execute here MyI2Cdevice.Dispose();
This create-dispose way seems to be rather inefficient, as I need to poll the sensors sequentially. I have no problem with getting all my readings if I do it this way, but is this the best way to write the code?
#22048 LCD4884 DFRobot shield SPI interface
Posted by teo on 24 December 2011 - 03:52 AM in Netduino Plus 2 (and Netduino Plus 1)
I have found a solution for the problem (not perfect, but works).
There is a column of pads on the bottom-left corner of the LCD. Connect "SCLK" to Pin13 and "SDIN" to Pin11. Optionally, you can connect digital pin 10 to "BL_ON". These pins are easily accessible from the built-in rc servo connectors.
Then, use the driver found here:
http://wiki.netduino...hx?NoRedirect=1
(I didn't try the 3310 driver you mentioned)
Next, make these two changes:
// From "Program.cs": Nokia_5110 Lcd = new Nokia_5110(true, Pins.GPIO_PIN_D10, Pins.GPIO_PIN_D9, Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D8); // Change to: Nokia_5110 Lcd = new Nokia_5110(false, Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D6, Pins.GPIO_PIN_D4); // If pin 10 is connected to "BL_ON", then change to: Nokia_5110 Lcd = new Nokia_5110(true, Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D10, Pins.GPIO_PIN_D6, Pins.GPIO_PIN_D4);Why: To match the DFR lcd pin out.
// From initialisation line of "Nokia.cs": spi.Write(new byte[] { 0x21, 0xBF, 0x04, 0x14, 0x0C, 0x20, 0x0C }); // Change to: spi.Write(new byte[] { 0x21, 0xc0, 0x06, 0x13, 0x20, 0x0c });Why: Frankly, I do not know *why* .. I just followed the initialisation procedure from the original Arduino driver (LCD4884.cpp). If you are curious, you may want to check the datasheet of the LCD driver. If you skip this change, the contrast of the display will be very poor.
Some notes:
-(updated)If you find that there are some artefacts on the screen, you may need to reduce the SPI clock from 4000kHz to 1000kHz. I found that 1000kHz worked better for me.
-The "useBacklight" parameter must be set to "false" as the DFR LCD's backlight pin is digital pin 7 (not a PWM pin). You can still switch it on and off, but you cannot dim it by the PWM hardware. However, I have connected digital pin 10 to the "BL_ON" pad of the LCD so that I can still use the PWM functionality.
-The drawback of this method is that digital pins 2,3 (the former CLK and MOSI lines) are no longer usable as GPIO pins since they are now electrically connected to pins 13,11, respectively. You will further waste digital pin 7 (the former backlight pin) if you have connected digital pin 10 to "BL_ON".
#22046 LCD4884 DFRobot shield SPI interface
Posted by teo on 24 December 2011 - 12:55 AM in Netduino Plus 2 (and Netduino Plus 1)
- Netduino Forums
- → teo's Content
- Privacy Policy