There is a bug in the SoftwareI2CBus module. Where it calls SoftwareI2C receive, the first parameter needs to be false if it is receiving the last byte of data from a slave. I2C protocol says the master must send a NAK to the slave on the last byte of data from the slave to tell it that is all the data it is expecting.
- Netduino Forums
- → k0fei's Content
k0fei's Content
There have been 10 items by k0fei (Search limited from 27-September 23)
#55086 I2C Software Workaround for Plus 2
Posted by k0fei on 31 December 2013 - 11:02 PM in Netduino Plus 2 (and Netduino Plus 1)
#55079 SPI Clock stays High during Idle
Posted by k0fei on 31 December 2013 - 06:32 PM in Netduino Plus 2 (and Netduino Plus 1)
Hi Chris,
I left more info on the thread about the I2C not working including the test code.
I can get you a logic trace of the I2C bug but it just two lines staying high.
MiniJTAG - Got it.
#55061 SPI Clock stays High during Idle
Posted by k0fei on 01 January 2014 - 02:41 AM in Netduino Plus 2 (and Netduino Plus 1)
Thanks Chris. I am talking to 8 devices, but doing my own select before starting a transfer and strobing in the data after the transfer. After a transfer I would like to clock to go low and stay low between transfers. I suppose I could put an inverter in the hardware, but hoped there was a way to do it in software.
By the say, how do you debug the firmware. I would be willing to give it a go, especially to fix the I2C driver. Emulating the I2C bus in software is not ideal.
Frank
#55056 SPI Clock stays High during Idle
Posted by k0fei on 31 December 2013 - 07:06 PM in Netduino Plus 2 (and Netduino Plus 1)
I have firmware 4.2.2.2 on brand new Netduino Plus 2 boards. The SPI clock line stays high during idle times. I have tried changing the parameter to tell it to stay low, but it has no effect. Any suggestions?
Thanks - Frank
#55452 I2C Bus not working
Posted by k0fei on 17 January 2014 - 10:14 PM in Netduino Plus 2 (and Netduino Plus 1)
I will try the custom.ufd in the thread above, but it sounds like it is going to fix it. Hopefully the Netduino folks will include your fix in the next release - or at least add a bug to their list about I2C problems. Thanks for pointing me to what looks like a solution.
#55148 I2C Bus not working
Posted by k0fei on 02 January 2014 - 11:43 PM in Netduino Plus 2 (and Netduino Plus 1)
I am hooked up to the right pins - SCL and SDA. I actually have 3 devices on that bus - the TMP100, a DS1307 and a MCP2301 port expander. I am using 10K pull-ups. I'll write a test program using the SoftwareI2C code. My development code is using the SofwareI2CBus and some hacks so I can multi-thread for the devices (as well as the bug fix I posted on another thread).
The Logic 16 is indeed connected to the SCL and SDA pins. I see the data under the SoftwareI2C (that is how I found that SoftwareI2CBus was sending an ACK not a NAK on the last byte to be read from a slave), but no data at all - even an address - under hardware I2C. I tried the same test program on a brand new out of the box Netduino Plus 2 fresh from Mouser - still no luck. I was hoping someone could tell me what I messed up in my test program.
#55078 I2C Bus not working
Posted by k0fei on 31 December 2013 - 06:25 PM in Netduino Plus 2 (and Netduino Plus 1)
I am trying to read a TMP100 temperature sensor. It works when I use the I2C Software emulation code SoftwareI2CBus so I know the hardware is good. When I try using I2CDevice the SCL and SDA pins just stay high. I have a Saleae Logic 16 on the pins. I see data using the software emulation but not using the I2CDevice.
Here is the code:
[color=#2d2cfa;]using[/color] System;
[color=#2d2cfa;]using[/color] System.Net;
[color=#2d2cfa;]using[/color] System.Net.Sockets;
[color=#2d2cfa;]using[/color] System.Threading;
[color=#2d2cfa;]using[/color] Microsoft.SPOT;
[color=#2d2cfa;]using[/color] Microsoft.SPOT.Hardware;
[color=#2d2cfa;]using[/color] SecretLabs.NETMF.Hardware;
[color=#2d2cfa;]using[/color] SecretLabs.NETMF.Hardware.Netduino;
namespace[color=#000000;] I2CTest[/color]
{
[color=#000000;] [/color]public[color=#000000;] [/color]class[color=#000000;] [/color][color=#34a2bb;]Program[/color]
{
[color=#2d2cfa;]public[/color] [color=#2d2cfa;]static[/color] [color=#2d2cfa;]void[/color] Main()
{
[color=#000000;] [/color]I2CDevice[color=#000000;].[/color]Configuration[color=#000000;] config = [/color][color=#2d2cfa;]new[/color][color=#000000;] [/color]I2CDevice[color=#000000;].[/color]Configuration[color=#000000;](0x48, 100);[/color]
[color=#34a2bb;]I2CDevice[/color] dev = [color=#2d2cfa;]new[/color] [color=#34a2bb;]I2CDevice[/color](config);
[color=#000000;] [/color]// Make the transactions
[color=#34a2bb;]Byte[/color][] tempData = [color=#2d2cfa;]new[/color] [color=#34a2bb;]Byte[/color][2];
[color=#2d2cfa;]var[/color] transaction = [color=#2d2cfa;]new[/color] [color=#34a2bb;]I2CDevice[/color].[color=#34a2bb;]I2CTransaction[/color][] {
[color=#34a2bb;]I2CDevice[/color].CreateWriteTransaction([color=#2d2cfa;]new[/color] [color=#34a2bb;]Byte[/color][] {0x00}),
[color=#34a2bb;]I2CDevice[/color].CreateReadTransaction(tempData)
};
[color=#34a2bb;]Int32[/color] bytesTransfered = dev.Execute(transaction, 300);
[color=#2d2cfa;]if[/color] ( bytesTransfered == 0)
{
[color=#000000;] [/color][color=#2d2cfa;]throw[/color][color=#000000;] [/color][color=#2d2cfa;]new[/color][color=#000000;] [/color][color=#34a2bb;]Exception[/color][color=#000000;]([/color]"I2C transaction failed"[color=#000000;]);[/color]
}
[color=#34a2bb;]UInt16[/color] utmp = tempData[0];
utmp <<= 8;
utmp |= tempData[1];
[color=#34a2bb;]Int16[/color] tmp = ([color=#34a2bb;]Int16[/color])utmp;
[color=#34a2bb;]Double[/color] temp = ([color=#34a2bb;]Double[/color])tmp;
temp /= ([color=#34a2bb;]Double[/color])256;
[color=#34a2bb;]Debug[/color].Print(temp.ToString() + [color=#b51f20;]" Degrees C"[/color]);
}
}
}
#55055 I2C Bus not working
Posted by k0fei on 31 December 2013 - 07:02 PM in Netduino Plus 2 (and Netduino Plus 1)
I can't get the SDA and SCL pins on a Netduino Plus 2 to respond using the I2CDevice class. The logic analyzer sees no clock or data, the lines just stay high. I have 10k pull-up resistors. I can control the pins as output and the SoftwareI2C code drives them at a about 1.5 khz. I have tried it on two brand new boards, the same result. I must be doing something wrong. This is the 4.2.2.2 firmware that comes on new boards.
Thanks - Frank
#56000 How do I get a defective board replaced
Posted by k0fei on 10 February 2014 - 06:01 PM in Netduino Plus 2 (and Netduino Plus 1)
One of a batch of 6 Netduinos is defective. How do I get it replaced?
Thanks
#54759 Why is operational Temp limited to 0C
Posted by k0fei on 18 December 2013 - 04:53 PM in Netduino Plus 2 (and Netduino Plus 1)
The Netduino Plus 2 has an operational temperature range of 0 - 70 C. What limits it from being operational down to -40 C? I would like to use it in an outdoor project that could go to -40C.
- Netduino Forums
- → k0fei's Content
- Privacy Policy