CW2's Content - Netduino Forums - Page 6
   
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.

CW2's Content

There have been 148 items by CW2 (Search limited from 29-April 23)


By content type

See this member's


Sort by                Order  

#57132 Accessing the Timer/Counter block

Posted by CW2 on 26 March 2014 - 08:38 AM in Netduino Plus 2 (and Netduino Plus 1)

Well, there are no classes for direct timer access in the current version of .NET Micro Framework, mainly due to the fact that the managed (C#) code is interpreted and running considerably slowly than native (C++) code. IIRC simple pin toggling loop on Netduino gen. 1 can achieve ~10 kHz. Even if you were able to access the timers, you would not have much time to run managed code in the interrupt handler (if at all).

 

What do you want to do?




#57051 Analog Output

Posted by CW2 on 24 March 2014 - 07:51 AM in Netduino Plus 2 (and Netduino Plus 1)

In addition to what Nevyn said, you could use PWM with low-pass RC filter as cheap D/A converter.




#57050 Adafruit Ultimate GPS with N+2. Any experiences?

Posted by CW2 on 24 March 2014 - 07:47 AM in Netduino Plus 2 (and Netduino Plus 1)

I´m pretty sure that the (my?) Netduino brings some kind of noice to it´s 3,3V and 5V outputs used to power the GPS. And this is obviously not noice from the mains voltage since the battery powered Netduino/GPS combination also behaves very strange.

 
Thanks for all the information. IMHO the other options has been ruled out and power noise is what remains. There is a switching regulator (ST1S12GR, datasheet) on board and also the microcontroller itself is source of high frequency noise, so it seems some connection is picking that up. The GPS module datasheet states "The VCC ripple must be controlled under 50 mVPP", which should be within the ST1S12GR specification (*). 
 
(*) Reference load regulation typ. 0.0025 %VO/mA, for VO = 3.3V and IO = 170 mA it is 0.0025*170 % of 3.3V = 14 mV.
 

An oscilloscope would be helpful. I´m trying to get one...


EEVblog #594 – How To Measure Power Supply Ripple & Noise  ;)




#57039 Adafruit Ultimate GPS with N+2. Any experiences?

Posted by CW2 on 23 March 2014 - 10:20 PM in Netduino Plus 2 (and Netduino Plus 1)

I taped the GPS breakout right into my roof-light powered by 3 AA batteries and not connected to the Netduino board. It got a sat fix after about 2-3 mins (rainy weather outside).

 
Was Netduino running during that time?
 

Next I used a 9V battery to power the Netduino and connected the GPS breakout to the Netduino´s 5V and GND to power it.


How far is Netduino from the GPS module?

Have you tried adding some shielding to Netduino? If not, try placing a grounded metal sheet between Netduino and the GPS module, or carefully wrap Netduino in aluminium foil and connect it to ground - but make sure it does not short out the pins on the bottom, better to place some paper or tape there.



#57035 Interrupt Port and Input Port Read Values are Wrong on First Interrupt.

Posted by CW2 on 23 March 2014 - 08:44 PM in General Discussion

I have not tried to reproduce the behavior, but there is one fundamental issue with using port.Read() in the interrupt handler: because the interrupts are queued, the handler is executed after a certain period of time, thus port.Read() returns the port state at the time the interrupt handler is being executed, not when the interrupt occurred. This can cause incorrect results, especially when the pulse duration or frequency is close to execution time of the interrupt handler (managed code).

 

I guess a better way is to use two interrupt ports, both set up for falling and rising edge (InterruptEdgeBoth) and use the handler parameters data1 (port number), data2 (port state, 1/0) and timestamp in a state machine (you can reuse one xxx_OnInterrupt handler).




#56884 Netduino 2 Firmware v4.3.1 with GCC support

Posted by CW2 on 17 March 2014 - 10:42 PM in Beta Firmware and Drivers

Well, assuming that you don't have JTAG/SWD in-circuit debugger, the options are... ...challenging  ;)

  • At first, modify the value of <OEMSystemInfoString/> in Solutions\Netduino2\Netduino2.settings - you can then verify (e.g. in MFDeploy) that the device is running your updated firmware,
  • For diagnostic output that appears in the debugger (Visual Studio or MFDeploy) use CLR_Debug::Printf(...) (#include <TinyCLR_Debugging.h> or #include <TinyCLR_Runtime.h>).
  • For low-level diagnostic output you could use hal_printf or debug_printf; it is usually better to reconfigure STDIO and DEBUG_TEXT_PORT to serial port (e.g. COM1) instead of USB (default).
  • The above functions significantly affect code timing and might not be available/should not be called in a particular context (such as interrupt handler) - there you are left with pin toggling (LED blinking, logic analyzer).



#56883 I2C Bus Problem - Debugging

Posted by CW2 on 17 March 2014 - 10:13 PM in General Discussion

That file lives in two places:

C:\MicroFrameworkPK_v4_3\DeviceCode\Targets\Native\Netduino_STM32\DeviceCode\STM32_I2C\STM32_i2c_functions.cpp

and

C:\MicroFrameworkPK_v4_3\DeviceCode\Targets\Native\STM32\DeviceCode\STM32_I2C\STM32_i2c_functions.cpp

 

(I modified both)

 

For Netduino 2 you need to modify only files in Targets\Native\Netduino_STM32. The STM32 folder contains the original Oberon's implementation, which is not used - Netduino_STM32 is basically STM32 + Secret Labs' modifications.

 

In fact, you could delete all subdirectories in Targets\Native and Solutions that do not have Netduino,Template or Windows in their name - I usually do that to reduce code search result noise...




#56879 Netduino 2 Firmware v4.3.1 with GCC support

Posted by CW2 on 17 March 2014 - 04:58 PM in Beta Firmware and Drivers

Those are libraries and stubs for tools and Windows2 solution, which do not need to be rebuilt when you make changes to a particular solution (your firmware).

 

There are a few 'clean' targets, you can display them for example by launching

msbuild Solutions\Netduino2\dotnetmf.proj /t:Help 

For a 'complete clean' build, delete the build output directory

rmdir /s /q BuildOutput



#56876 Netduino 2 Firmware v4.3.1 with GCC support

Posted by CW2 on 17 March 2014 - 03:57 PM in Beta Firmware and Drivers

Does this affect the Netduino build? Do I need to install .Net2.0 framework?

 

No, you can safely ignore this warning. IIRC it is caused by incorrect ToolsVersion attribute value in a few project files, which causes MSBuild 3.5 to be run, instead of 4.0. I have already fixed such issues, but in separate 'cleanup' branch, which will be integrated into a future release...




#56874 Netduino 2 Firmware v4.3.1 with GCC support

Posted by CW2 on 17 March 2014 - 03:46 PM in Beta Firmware and Drivers

So it appears there are some more Prerequisites that should be in the top list. I've got Visual Studio 2013 Ultimate installed, and it contains Visual C++.


According to .NET Micro Framework Porting Kit 4.3 ReleaseNotes.txt "Either Visual Studio 2012 (Express edition or greater) or both .NET Framework 3.5 and Windows SDK for Windows" is required.
 
In order to get Visual Studio 2013 working, you'd have to modify setenv_base.cmd - add %VS120COMNTOOLS% to the block of conditions, or simply change the existing %VS110COMNTOOLS% to 12. However, I am not sure this would be enough, due to the MSBuild 2013 changes and several project files having incorrect and/or missing ToolsVersion attribute.




#56867 Compiling Custom Netduino Firmware: Step-By-Step Instructions - Help

Posted by CW2 on 17 March 2014 - 12:48 PM in General Discussion

Any update on this?

 

Please have a look at Netduino 2 Firmware v4.3.1 with GCC support




#56866 Netduino 2 Firmware v4.3.1 with GCC support

Posted by CW2 on 17 March 2014 - 12:39 PM in Beta Firmware and Drivers

Prerequisites

 

How to build the firmware with GCC

  • Install GCC, preferably to short path with no spaces, e.g. C:\GCC
  • Install .NET Micro Framework Porting Kit 4.3 QFE1 (C:\MicroFrameworkPK_v4_3)
  • Copy C:\MicroFrameworkPK_v4_3 to C:\Netduino2
  • Extract Netduino 2 Firmware v4.3.1 source to C:\Netduino2, overwrite all
  • Extract Netduino 2 Firmware v4.3.1 source for GCC to C:\Netduino2, overwrite all
  • Launch cmd.exe
    cd \Netduino2
    setenv_gcc 4.8.3 C:\GCC
    msbuild Solutions\Netduino2\dotnetmf.proj /p:Flavor=Release /v:m
    
  • The build should succeed, with a few warnings
  • Extract NetduinoUpdate_4.3.1.0.zip (C:\NetduinoUpdate_4.3.1.0)
  • Copy the firmware image C:\Netduino2\BuildOutput\THUMB2\GCC4.8\le\FLASH\release\Netduino2\bin\tinyclr.hex\ER_FLASH to C:\NetduinoUpdate_4.3.1.0\Firmware\Netduino2_4_3_1_0\ER_FLASH.s19 (rename - add extension)
  • Open ER_FLASH.s19 in you favorite text editor and delete the first line (starts with S0), save.
  • Launch NetduinoUpdate.exe, plug in your Netduino 2 and update the firmware.

 

Important notes

  • GCC support added and verified only for Netduino 2 (mainly due to resource/time constraints),
  • Other GCC toolchains might work or need only minor changes, but make sure they have support for long-long and long-double (IIRC Yagarto does not have it by default) - otherwise formatted string output for C# long and double does not work,
  • Included are a few bug fixes and modifications from my NETMF Fork project (which will be released probably later this year):
    • Fixed MMP : error MMP0000: 0x80131700 (#221, #2202),
    • Fixed GCC compiler errors in BitConverter.cpp (#2216),
    • Added ABORTS_REDUCESIZE symbol to exclude interactive debugging code (#1908),
    • Added support for recent Keil MDK-ARM toolchain (#1795)

 

Attached Files

 

Edit 2014-03-18 19:30 UTC: Added Visual Studio to prerequisite list




#56778 Native Code in C++

Posted by CW2 on 13 March 2014 - 08:02 AM in General Discussion

Well, it depends on what exactly do you mean by "MiniJTAG"?

 

You'd need in-circuit debugger/programmer to deploy and debug the code, popular choices are for example ST-LINK/V2 or Segger J-Link. There are many others, but you should check VisualGDB support; they have tutorials for ST-Link and J-Link, so these two should work. They have standard 20 pin 0.1" pitch JTAG connector, so you'd need also an adapter for 10 pin 0.05" pitch mini JTAG, which looks like this or this, and if your Netduino does not come with the pin header, you'd need it too (FCI part at Digikey, or similar).

 

Tip: You can make el cheapo mini JTAG header from a copper wire: cut 10 pieces about 10 mm long from solid core copper wire that fits into Netduino board holes, insert them all into the female header so they stay in place and have proper length, stick through the board, solder and carefully cut the excess  ;)




#56773 Emulator, can it handle OneWire ?

Posted by CW2 on 12 March 2014 - 06:29 PM in General Discussion

hi, is there a software to search the address of ds18b20?

 

What exactly would you need to do? The 1-Wire protocol has built-in mechanism for enumerating the devices present on the bus, all implementations I've seen support that - in the particular case of .NET Micro Framework, have a look at OneWire.FindAllDevices() method.




#56765 Native Code in C++

Posted by CW2 on 12 March 2014 - 08:04 AM in General Discussion

Unfortunately, Visual Studio does not support deployment over JTAG and I am not sure its ARM compiler can generate code for Cortex-M series. Probably the closest thing is VisualGDB.




#56736 Netduino Plus 2 Firmware v4.3.1

Posted by CW2 on 10 March 2014 - 11:17 AM in Netduino Plus 2 (and Netduino Plus 1)

Finally, I succeeded compilation. TinyBooter is working. But TinyCLR doesn't. It wasn't detected on MF deploy.
 
What should I do?

 

I guess you have not set the proper cpu architecture - I think without it the compiler generates some ARM code, which is not supported on Cortex-M cores and TinyCLR is stuck in an fault handler. You'd need to add <DEVICE_TYPE>cortex-m3</DEVICE_TYPE> to Netduino2.settings; and also Microsoft.Spot.system.MDK.Targets might need some additional changes.




#56666 ND1 - Input is always TRUE

Posted by CW2 on 06 March 2014 - 09:47 AM in Netduino 2 (and Netduino 1)

Because on N2 and N2+ i have connected digital input with 3V then i get tue Value....

 
Hm, does that mean that on N2 and N2+ unconnected input pin created with ResistorMode.PullUp returns false? That does not seem to be right - it's either a bug or you've inadvertently used ResistorMode.PullDown (?)




#56639 ND1 - Input is always TRUE

Posted by CW2 on 05 March 2014 - 11:45 AM in Netduino 2 (and Netduino 1)

Quiz question: What return value do you expect from an unconnected input pin?

 

The thing is that you created input pin with ResistorMode.PullUp, which means the pin is in logic high (returns true), unless it is connected to other logic level (logic low, ground). Thus, if you want your input pin Read() method to return false, you have to wire the pin to GND.

 

If you use a port in output mode, its Read() method basically just returns the current state - i.e. the initial state passed via constructor parameter or what was set in the last call of Write() method.




#56625 Source Control for Porting Kit and netduino

Posted by CW2 on 04 March 2014 - 04:41 PM in General Discussion

There are certainly more ways how to do it, based on personal preferences and development workflow, but you'd probably need to set up a few branches - I usually use something like this: 
master  O-- ...                                                         --[My 1.0]...
         \                                                                   ^
netmf     \--[NETMF4.3]--[NETMF4.3QFE1] ... [NETMF vNext]                   /
                                \                        \  (merge)        /
netduino                         \--[SL 4.3.1] ...    [SL vNext]...       /
                                          \                              /     
my-netduino-changes                        \[Change #1]--[Change #2]... /
This allows me to have complete reference of the official .NET Micro Framework codebase (it would be easier if the Microsoft team decided to use git on CodePlex) and also vendor firmware releases. Every new release is simply added to the appropriate branch, then you can decide what changes will be merged where, if at all. Similarly, development of modifications (features, bug fixes, whatever) happens in a dedicated branch and the finished work will be merged where needed - although it might sound a little bit complicated at first, it is actually very easy to do, especially in git.



#56577 Compiling Custom Netduino Firmware: Step-By-Step Instructions - Help

Posted by CW2 on 02 March 2014 - 12:40 PM in General Discussion

EDIT: the first error seems to happen when building TinyBooter, it says the target CPU doesn't support ARM mode

 
The Cortex-M is not supported in the build files, you'd have to add appropriate -mcpu directive in the Microsoft.Spot.System.GCC.Targets file; plus a few other changes. The easiest way is to download Microsoft.Spot.system.gcc.targets from NicolasG's repository, copy it into \Tools\Targets directory (overwrite the existing one).
 
However, you'll get several other errors, some were introduced in BitConverter.cpp, also there are missing GCC scatterfiles in Netduino2 solutions, which are mandatory for the linker.
 
I am now working on fixing GCC support for Netduino2 solutions, I'll publish the source code with detailed instructions when it's done.



#56570 Compiling Custom Netduino Firmware: Step-By-Step Instructions - Help

Posted by CW2 on 02 March 2014 - 07:19 AM in General Discussion

 

setenv_base.cmd GCC4.6 PORT c:\yagarto-4.6.0

 

The 'PORT' parameter is not used in NETMF 4.3, you should call setenv_gcc.cmd:

 

setenv_gcc.cmd 4.6.2 C:\Yagarto-4.6.2

 

The version number (4.6.2) must match the directory name in lib\gcc\arm-none-eabi.




#56508 Compiling Custom Netduino Firmware: Step-By-Step Instructions - Help

Posted by CW2 on 27 February 2014 - 10:51 PM in General Discussion

Assumptions: Using Netduino 4.3 firmware/framework, and 4.3 SDK and VS2012 Express.

 

The Express edition is not enough for building the firmware, you need Visual C++ compiler too, that means Visual Studio 2012 Professional or higher.




#56283 PT100

Posted by CW2 on 22 February 2014 - 09:20 PM in General Discussion

Short answer: the PT100 is a resistive sensor, so you cannot connect it directly to an analog input.   Long answer: You'd have to use at least a voltage divider circuit, so you can measure the voltage drop over the sensor and make sure to use low current - usually up to [only] 1 mA, to prevent sensor damage and also reduce self-heating. PT100 is a precision sensor and getting accurate measurements require non-trivial circuits - for example, PT100 has about 20 ? difference in temperature range 0 - 50°C, which at 1 mA translates to 20 mV; also the parameters of microcontroller's ADC has to be considered. I'd recommend you to do some more research and have a look at articles like PT100 sensor - help a beginner? or Can't get a precise reading with PT100 temperature sensor. You might end up with the bridge configuration plus op-amps, or a specialized IC...





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.