Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

tma's Content

There have been 12 items by tma (Search limited from 19-April 23)


By content type

See this member's

Sort by                Order  

#51927 Proprietary Netduino2 PCB - Loading Program

Posted by tma on 03 August 2013 - 08:45 PM in Netduino 2 (and Netduino 1)

nakchak,

 

thanks for your suggestion. I do not need the external reset, so I have not implemented that. 

But I just made some significant progress:
The problem seems to be related to the software, at least in some way.

 

It seems that there is some interference with the Serial Port, defined as:
[font="'courier new', courier, monospace;"]ReadPort = new SerialPort(SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One);[/font]

 

If I don't use that port, then the software reset seems to work.

 




#51902 Proprietary Netduino2 PCB - Loading Program

Posted by tma on 02 August 2013 - 08:52 PM in Netduino 2 (and Netduino 1)

I am getting a bit further now. It seems that VS Studio can deploy the application via USB to the PCB. Immediately after the deployment the PCB should reboot in order to get into Debug mode and let itself debug from Visual Studio. This doesn't work. I suspect it is something I am not doing correctly in the hardware. Does anybody have an idea what particular hardware requirements are needed for that?

 

Thanks




#51853 Proprietary Netduino2 PCB - Loading Program

Posted by tma on 01 August 2013 - 05:04 AM in Netduino 2 (and Netduino 1)

I have built a proprietary Netduino2-based PCB, running the STM32F205RGT6 processor.

V4.2 firmware loaded correctly, the board is recognized as Netduino and I was able to load the first test program from Visual Studio.

 

But now I cannot load any other program anymore, I get the infamous "Unable to communicate with device" message.

 

The PCB doesn't contain any circuitry to reset the board when Visual Studio starts communicating with the board. Am I missing something?

Does anybody know if there is an additional handshake or reset taking place when uploading programs via USB than just USB communication?




#49565 I2C InternalAddress (repeated start bit) support

Posted by tma on 19 May 2013 - 02:36 PM in Beta Firmware and Drivers

OK, I think I resolved it myself.

For the Netduino 2 the repeated start bit feature seems to work without needing this workaround, so standard features from the  I2CDevice.I2CTransaction class can be used directly.




#49564 I2C With Triple Axis Accelerometer - MMA8452Q

Posted by tma on 19 May 2013 - 02:29 PM in Netduino 2 (and Netduino 1)

OK, I got it working on the Netduino 2:

It seems that the repeated start bit is handled in the Netduino 2, hence the [color=rgb(90,90,90);font-family:helvetica, arial, sans-serif;font-size:13px;background-color:rgb(234,248,226);] [/color]special I2C methods (which seem not to work with the Netduino 2) are not required for the Netduino 2.

 

Hence, you can use the code that I have originally posted - it does work for me - I can now read all the registers correctly.

Something like the code below should work for reading x, y and z position to an accuracy of one byte, only using the MSB registers. If you need higher resolution you will also need to consider the LSB registers. 

 

 

[color=#008000;][font="'courier new', courier, monospace;"]         // Version for Netduino 2[/color][/font]
[font="'courier new', courier, monospace;"]         int[]  Position = new int[3];[/font]

[font="'courier new', courier, monospace;"]         byte[] data = new byte[7];[/font]

 

[font="'courier new', courier, monospace;"]         I2CDevice.I2CTransaction[] rwtransaction = new I2CDevice.I2CTransaction[2] [/font]
[font="'courier new', courier, monospace;"]         {[/font]
[font="'courier new', courier, monospace;"]            I2CDevice.CreateWriteTransaction(new byte[1] { 0x00 }), [/font]
[font="'courier new', courier, monospace;"]            I2CDevice.CreateReadTransaction(data)[/font]
[font="'courier new', courier, monospace;"]         };[/font]
[font="'courier new', courier, monospace;"] [/font][font="'courier new', courier, monospace;"]       int bytesRead = icDevice.Execute(rwtransaction, 50);[/font]
[font="'courier new', courier, monospace;"]         Position[0] = (int)(sbyte)[/font][font="'courier new', courier, monospace;"]data[1];[/font]
[font="'courier new', courier, monospace;"]         Position[1] = [/font][font="'courier new', courier, monospace;"](int)(sbyte)[/font][font="'courier new', courier, monospace;"]data[3];[/font]
[font="'courier new', courier, monospace;"]         Position[2] = [/font][font="'courier new', courier, monospace;"](int)(sbyte)[/font][font="'courier new', courier, monospace;"]data[5];[/font]



#49534 I2C InternalAddress (repeated start bit) support

Posted by tma on 18 May 2013 - 06:27 PM in Beta Firmware and Drivers

I have no success using this code on Netduino 2.

While it works fine for the Netduino 1, running it on Netduino 2 (firmware V 4.2.2.2), throws an exception because [color=#ff0000;]fieldInfo[/color] remains Null after the line:

 

 

[font="'courier new', courier, monospace;"][color=rgb(102,0,102);]FieldInfo[/color] [color=#ff0000;]fieldInfo[/color] [/font][color=rgb(102,102,0);]=[/color] readTransactionType[color=rgb(102,102,0);].[/color][color=rgb(102,0,102);]GetField[/color][color=rgb(102,102,0);]([/color][color=rgb(0,136,0);]"Custom_InternalAddress"[/color][color=rgb(102,102,0);],[/color] [color=rgb(102,0,102);]BindingFlags[/color][color=rgb(102,102,0);].[/color][color=rgb(102,0,102);]NonPublic[/color] [color=rgb(102,102,0);]|[/color] [color=rgb(102,0,102);]BindingFlags[/color][color=rgb(102,102,0);].[/color][color=rgb(102,0,102);]Instance[/color][color=rgb(102,102,0);])[/color][font="'courier new', courier, monospace;"];[/font]

 

 

Any suggestion?

 

Thanks - Thomas

 

 




#49520 I2C With Triple Axis Accelerometer - MMA8452Q

Posted by tma on 17 May 2013 - 11:24 PM in Netduino 2 (and Netduino 1)

cmelk75, sorry, I have not noticed your question earlier.

But it happens that I am trying to port my application to a Netduino 2 - and I cannot get it work.

There are various threads about problems with I2C on Netdiuino 2.

So far I have tried:

- Decrease the value of the pull-up resistors to 1k

- Upgrade firmware to 4.2.2.2

Neither has helped :-(




#42336 I2C With Triple Axis Accelerometer - MMA8452Q

Posted by tma on 28 December 2012 - 07:23 AM in Netduino 2 (and Netduino 1)

CW2, I have updated the Firmware to 4.2 and used the recommended way to address the I2C registers in read mode - and it works like a charm! Thanks very much for your great help - Happy New Year!




#42234 I2C With Triple Axis Accelerometer - MMA8452Q

Posted by tma on 26 December 2012 - 10:13 PM in Netduino 2 (and Netduino 1)

Thanks so much for your education - it will take me a while to update the firmware - it will be the first time for me doing it.  I will keep you posted.




#42231 I2C With Triple Axis Accelerometer - MMA8452Q

Posted by tma on 26 December 2012 - 09:50 PM in Netduino 2 (and Netduino 1)

I may have an older version:  4.1.0.6, may this be the issue?

 



#42229 I2C With Triple Axis Accelerometer - MMA8452Q

Posted by tma on 26 December 2012 - 09:00 PM in Netduino 2 (and Netduino 1)

CW2, thanks very much for the quick response, I very much appreciate. 

I have tried this before, but did not succeed to get it running, I always get a Null Value for fieldInfo:

 

 

[font="'courier new', courier, monospace;"] public class Program[/font]
[font="'courier new', courier, monospace;"]    {[/font]
[font="'courier new', courier, monospace;"]    public static I2CDevice.I2CReadTransaction CreateReadTransaction(byte[] buffer, uint internalAddress, byte internalAddressSize)[/font]
[font="'courier new', courier, monospace;"]        {[/font]
[font="'courier new', courier, monospace;"]            I2CDevice.I2CReadTransaction readTransaction = I2CDevice.CreateReadTransaction(buffer);[/font]
[font="'courier new', courier, monospace;"]            Type readTransactionType = typeof(I2CDevice.I2CReadTransaction);[/font]
 
[font="'courier new', courier, monospace;"]            FieldInfo [color=#ff0000;]fieldInfo[/color] = readTransactionType.GetField("Custom_InternalAddress", BindingFlags.NonPublic | BindingFlags.Instance);[/font]
[font="'courier new', courier, monospace;"]            fieldInfo.SetValue(readTransaction, internalAddress);[/font]
 
[font="'courier new', courier, monospace;"]            fieldInfo = readTransactionType.GetField("Custom_InternalAddressSize", BindingFlags.NonPublic | BindingFlags.Instance);[/font]
[font="'courier new', courier, monospace;"]            fieldInfo.SetValue(readTransaction, internalAddressSize);[/font]
 
[font="'courier new', courier, monospace;"]            return readTransaction;[/font]
[font="'courier new', courier, monospace;"]        }[/font]
[font="'courier new', courier, monospace;"]       [/font]
 
[font="'courier new', courier, monospace;"]     public static  void Main()[/font]
[font="'courier new', courier, monospace;"]        {[/font]
[font="'courier new', courier, monospace;"]            I2CDevice.Configuration Conf = new I2CDevice.Configuration(0x1D, 50);[/font]
[font="'courier new', courier, monospace;"]            I2CDevice icD = new I2CDevice(Conf);[/font]
 
[font="'courier new', courier, monospace;"]            byte[] data = new byte[7];[/font]
[font="'courier new', courier, monospace;"]            I2CDevice.I2CTransaction[] rwtransaction = new I2CDevice.I2CTransaction[] [/font]
[font="'courier new', courier, monospace;"]            {CreateReadTransaction(data, 0x0D, 1)};[/font]
[font="'courier new', courier, monospace;"]            int bytesRead = icD.Execute(rwtransaction, 50);[/font]
[font="'courier new', courier, monospace;"]         }[/font]
[font="'courier new', courier, monospace;"]     }[/font]
 
I guess I must do something wrong...



#42217 I2C With Triple Axis Accelerometer - MMA8452Q

Posted by tma on 26 December 2012 - 05:05 PM in Netduino 2 (and Netduino 1)

I have attached a Triple Axis Accelerometer Breakout - MMA8452Q from Sparkfun, https://www.sparkfun.../products/10955 to a Netduino board.
The physical connection seems to work, as well as writing and reading - the only problem, I cannot set the register to read from.

 

Following are some parts of the code I wrote:
 
[font="'courier new', courier, monospace;"] // Freescale MMA8452Q[/font]
[font="'courier new', courier, monospace;"]            I2CDevice.Configuration Conf = new I2CDevice.Configuration(0x1D, 50);[/font]
[font="'courier new', courier, monospace;"]            I2CDevice icD = new I2CDevice(Conf);[/font]
[font="'courier new', courier, monospace;"]            byte[] data = new byte[7];[/font]
 
[font="'courier new', courier, monospace;"] // Set Device Active  (This part works correctly)[/font]
[font="'courier new', courier, monospace;"]            I2CDevice.I2CTransaction[] writeTransaction = new I2CDevice.I2CTransaction[][/font]
[font="'courier new', courier, monospace;"]                {[/font]
[font="'courier new', courier, monospace;"]                    I2CDevice.CreateWriteTransaction(new byte[] {0x2A, 0x01})[/font]
[font="'courier new', courier, monospace;"]                };[/font]
[font="'courier new', courier, monospace;"]            int bytesWritten = icD.Execute(writeTransaction, 50);[/font]
 
[font="'courier new', courier, monospace;"]  // Try to read Device ID  (This part does not work correctly)[/font]
[font="'courier new', courier, monospace;"]            I2CDevice.I2CTransaction[] rwtransaction = new I2CDevice.I2CTransaction[2] [/font]
[font="'courier new', courier, monospace;"]                {[/font]
[font="'courier new', courier, monospace;"]                    I2CDevice.CreateWriteTransaction(new byte[1] { 0x0D }),[/font]
[font="'courier new', courier, monospace;"]                    I2CDevice.CreateReadTransaction(data)[/font]
[font="'courier new', courier, monospace;"]                 };[/font]
[font="'courier new', courier, monospace;"]            int bytesRead = icD.Execute(rwtransaction, 50);[/font]
[font="'courier new', courier, monospace;"]            Debug.Print(ByteToInt(data[0]).ToString());[/font]
 
It seems that the read register is not set to 0x0D, but that it is set to 0X00, hence the byte array "data" contains the content of the registers starting at 0X00.
 
Has anybody made the same experiences and found a way how to address this?
 
Thanks




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.