CW2's Content - Netduino Forums
   
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 28-April 23)


By content type

See this member's


Sort by                Order  

#59997 Windows on Devices? When?

Posted by CW2 on 05 September 2014 - 06:09 AM in General Discussion

Well arduino still doesn't have RTOS, Threading or whatever...

 

Not from my own experience, as I don't use RTOS on any Arduino, but quick check reveals that ChibiOS, BeRTOS, FreeRTOS support AVR (and there is about 40 more in the Wikipedia list that mentions AVR).




#59469 Windows on Devices? When?

Posted by CW2 on 30 July 2014 - 03:49 PM in General Discussion

Good news is coming.....

 

  1. ... "soon"
  2. ... "likely in the next few weeks"
  3. ... "in the coming weeks and months"
  4. ... "in the future"

:P




#58907 Windows on Devices? When?

Posted by CW2 on 26 June 2014 - 11:31 AM in General Discussion

In the dotnetConf 2014 session New Innovations in .NET Runtime Andrew Pardoe said:
 

38:45 "It is a full x86 computer... and it boots Windows..."
...
"The IoT team is working closely with .NET team..." ... "The IoT team of course has .NET Micro Framework..." "We also work closely with IoT team to make sure that the .NET Framework will work on devices like the Intel Galileo..."




#59798 Windows on Devices? When?

Posted by CW2 on 20 August 2014 - 03:50 PM in General Discussion

Running a simple .NET console app on the Intel Galileo with Windows by Pete Brown




#60173 Where are the COM ports located on the board?

Posted by CW2 on 21 September 2014 - 06:35 PM in Netduino Plus 2 (and Netduino Plus 1)

You'd need Cadence Allegro Viewer to view the brd file, it has different format and is not supported by Eagle. You can view the pin assignment in the schematics (pdf).




#60313 wait on interrupt

Posted by CW2 on 01 October 2014 - 09:26 AM in Netduino Plus 2 (and Netduino Plus 1)

I have to re-read the original post to understand what you are trying to do, but a few notes regarding the code:

  • You should specify pull-up resistor in the interrupt constructor, to prevent spurious events (use pull-up for low/falling edge, pull-down for high/rising edge),
  • If you really must disable interrupts, it is easier to set InterruptMode to InterruptNone. Disposing is rather costly and events can be missed (no event handler when disposed). Alternatively, you can use boolean variable checked in the interrupt handler
static bool buttonsDisabled = false;

static void DisableButtons()
{
  buttonsDisabled = true;
}

static void SW_OnInterrupt(uint data1, uint data2, DateTime time)
{
  if(buttonsDisabled)
    return;
  ...
}

Also, I would recommend you not to use threads initially - perhaps create a new project just to play with the button interrupts, experiment with different scenarios. Once you understand how it works, continue adding the functionality, implement threads only when really necessary/beneficial. In many cases, it is enough to use "Super-Loop" - the core/processing code is wrapped in while(true) loop implemented in Main() method, occasionally checking various state variables set by interrupt handlers.




#60298 wait on interrupt

Posted by CW2 on 30 September 2014 - 06:38 AM in Netduino Plus 2 (and Netduino Plus 1)

...it's not really an interrupt but a flag to the low level code to poll the pin and post an event at level change

 

Nope, there is no low level polling, but real hardware interrupts - when an interrupt condition is detected by pin logic a native interrupt handler is called, which creates event with timestamp and posts it into internal queue for the CLR to execute managed callbacks (event handlers).

 

@Grant: Have a look at InterruptPort class and its OnInterrupt event, you can re-use one event for multiple pins and then differentiate using its first parameter.




#60304 wait on interrupt

Posted by CW2 on 30 September 2014 - 12:19 PM in Netduino Plus 2 (and Netduino Plus 1)

I didn't know that CW2. Somewhere I read the timing could be off by 4us

 
Well, it certainly takes some time for the native interrupt handler to execute, but I don't have any numbers  :(
 

I guess it also depends on what you consider low level code, as pin logic certainly could be considered really low level code

 
I guess in principle yes, but there is no code executed in the similar way like CPU executes its instructions. The pin logic input circuitry for edge detection is just a few logic gates (of course in real microcontroller it is a little bit more complex) and the interrupts are handled in a specialized unit (for ARM it is named Nested Vectored Interrupt Controller, NVIC) - only after validation, prioritization etc. NVIC notifies CPU, which then loads an interrupt handler address from vector table and starts executing the instructions. If you are interested in more details, have a look for example at the following document.
 

Is there any reason to re-use an event handler other than to save memory, and we are talking about a very tiny routine as discussed.

 
Personally, I sometimes re-use event handler when I need to handle multiple buttons, like this
...
InterruptPort button1 = new InterruptPort(Pins.GPIO_PIN_D0, ...);
InterruptPort button2 = new InterruptPort(Pins.GPIO_PIN_D1, ...);
InterruptPort button3 = new InterruptPort(Pins.GPIO_PIN_D2, ...);
...
button1.OnInterrupt += button_Interrupt;
button2.OnInterrupt += button_Interrupt;
button3.OnInterrupt += button_Interrupt;
...
void button_Interrupt(uint data1, uint state, DateTime time)
{
  var pin = (Cpu.Pin)data1;
  var on = (state != 0);

  switch(pin)
  {
    case Pins.GPIO_PIN_D0:
      ...
      break;
    case Pins.GPIO_PIN_D1:
      ...
      break;
    ...
  }
  // Or use data1 as array index, collection key etc.
}
It also makes diagnostic/troubleshooting easier in certain cases.



#59769 Visual Studio 2014

Posted by CW2 on 18 August 2014 - 07:25 PM in Visual Studio

I have not tried it myself (*), but it should be possible to compile .NET MF SDK for Visual Studio 2014 with appropriate modifications as described in Jan Ku?era's article (for 2013); although it might need a fix or two for Visual Studio SDK assembly references (due to some versioning issues).
 
(*) I decided to postpone my playing with certain .NET MF areas after Microsoft announced they were working on Visual Studio 2013 integration and that it will be released as VSX extension (the last post). I hope such extension will be [Visual Studio] version-independent.
 
Sal Ramirez said earlier today:
 

NETMF is still alive. As far as the Visual Studio integration, the team hit a couple of issues with code signing and the build environment. As soon as we resolve those issues we will post an update.

Thanks,

Sal




#59431 Visual Studio 2013 official support yet?

Posted by CW2 on 29 July 2014 - 05:53 AM in Netduino Plus 2 (and Netduino Plus 1)

I think the most recent is comment by Sal Ramirez on the official .NET Micro Framework blog (posted on 7/11/2014):
 

Yes, we are working on Visual Studio 2013 support and we should have preview bits to release to the community soon, likely in the next few weeks.




#58666 VC0706 Adafruit camera and Netduino Plus 1

Posted by CW2 on 10 June 2014 - 05:43 PM in Netduino Plus 2 (and Netduino Plus 1)

How exactly are you converting the source string? Base64 is not simple substitution, it converts three octets (bytes) into four 6-bit encoded characters, using some bit manipulation.



#58673 VC0706 Adafruit camera and Netduino Plus 1

Posted by CW2 on 11 June 2014 - 07:54 AM in Netduino Plus 2 (and Netduino Plus 1)

Ok, thanks for the clarification. This was fixed in .NET Micro Framework 4.3 (see Issue #1388), you can set Convert.UseRFC4648Encoding property in order to get '+' and '/' instead of '!' and '*':
 

System.Convert.UseRFC4648Encoding = true;



#59528 Using Netduino to prototype & program a chip...

Posted by CW2 on 03 August 2014 - 12:27 PM in General Discussion

If I understand it correctly you want a custom board running Netduino firmware? Of course that is possible, as long as it is hardware compatible (e.g. clock frequency, inputs/outputs etc.). However, you'd need to have very good component source deals to make it cheaper (the microcontroller itself in single quantity costs significant part of the retail Netduino price, plus the other parts, PCB, assembly, testing etc.).




#60045 USB power vs. input power

Posted by CW2 on 09 September 2014 - 11:18 AM in Netduino Plus 2 (and Netduino Plus 1)

If I use an external power supply with 5V and connect it through the Micro USB port, will it provide sufficient power to the netduino including all pins (PWM, ...)?


Yes.
 

I can't find any available industrial power supplies with 7.5 - 9V

 

You don't need an industrial grade power supply, a wall adapter is sufficient.

 

I guess I can't use 5V input on the power socket?

 

No, the onboard linear regulator requires at least ~6.5 V input.




#58251 Understanding the Netduino 2 schematics - LMV7271MF and NTR4101PT1G

Posted by CW2 on 19 May 2014 - 11:11 AM in Netduino 2 (and Netduino 1)

Now when you mention LiPo battery - do you plan to have charging functionality on board? Because there are Li-Ion/Li-Po battery charge controlers with automatic power source selection. For example, Microchip Application Note 1149 shows a design with MCP73837 in which "The input power should supply the system load and charge the battery when a battery is present in the system. When the input power source is removed, the system is supported by the battery. When the system load and the battery draw more energy than the supply can offer, the system load takes priority over the battery charger."

 

So, you can for example power Netduino Mini always from the battery and let the MCP automatically handle the power source selection and battery charging. You'd probably need to select a little bit different battery setup (a separate cell for Netduino Mini?) or choose multi-cell charging IC (MCP73837 is only for a single cell, 4.2 - 4.5V).




#58172 Understanding the Netduino 2 schematics - LMV7271MF and NTR4101PT1G

Posted by CW2 on 16 May 2014 - 12:48 PM in Netduino 2 (and Netduino 1)

The basic operation of the circuit is to switch the USB power on, when voltage from power jack drops below a certain threshold.

The LMV7271 operational amplifier (op-amp) is used as a comparator, which produces output voltage VO = "1" if V+ > V-, and VO = "0" if V+ < V-. Thus, when VIN_PROTECTED < VIN_REF (*), the op-amp output switches the MOSFET on (**), which connects the USB power to +5V rail. Otherwise, USB power is disconnected and +5V rail voltage comes from 5V linear regulator U1 (MC33269).

 

(*) The exact voltage levels being compared are determined by resistor dividers:

 

VIN_COMP = VIN_PROTECTED*R28/(R8 + R28) = VIN_PROTECTED/2.4,

VIN_REF = 5*R27/(R27 + R31) = 5/2 = 2.5V

 

so the comparator output voltage VO = (VIN_PROTECTED/2.4) > 2.5V ? "1" : "0", which means the USB power is switched on when the power jack voltage drops below 2.5*2.4 = 6V. This is because the MC33269 regulator has 1.0V dropout voltage (its input voltage must be higher than output voltage, to ensure proper function).

 

(**) It is a P-channel MOSFET, which has inverted switching logic - it is "on" when the gate is "low".




#57800 Two's compliment byte array to int16 - confusing results.

Posted by CW2 on 28 April 2014 - 07:21 AM in General Discussion

For the serial number it says I will get back a 4 byte array which is the equivalent of this:
byte[] buff = new byte[8] { 0x00, 0x01, 0x36, 0xeb, 0x00, 0x0c, 0x45, 0xe3};
The number I am looking for is 79595 (real serial number of the camera)


Well, there is obviously an error in the documentation or you've pasted incorrect code - it says 4 byte array, yet it has 8 bytes. The number you are looking for 79595 is the first four bytes in the array: 
int serialNumber = (int)(buff[3] | (buff[2] << 8) | (buff[1] << 16) | (buff[0] << 24));
// 0xEB | 0x3600 | 0x010000 | 0x00 = 0x0136EB = 79595



#60406 Tic Toc

Posted by CW2 on 13 October 2014 - 04:48 PM in General Discussion

I have seen it in the other forum. Impressive, to say the least! Hats off to the electronics team  :P




#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.



#59770 Small update from the .net MF team

Posted by CW2 on 18 August 2014 - 07:51 PM in General Discussion

Fingers crossed  :P




#59607 Slow I2C Sensor Reads, is this normal?

Posted by CW2 on 08 August 2014 - 02:45 PM in Netduino Plus 2 (and Netduino Plus 1)

Well, I guess you could save a few ticks by retrieving all the X/Y/Z data in one transation - the datasheet says "Multiple data bytes can be written or read to numerically sequential registers without the need of another START condition", so it should be possible to use
...
var data = new byte[6];
getReadings = new I2CDevice.I2CTransaction[]
{
  I2CDevice.CreateWriteTransaction(new byte[] { 0x00 }), // Start at 0x00
  I2CDevice.CreateReadTransaction(data) // Read 6 bytes
};
...
You could then have three class member arrays and copy each result at once (Array.Copy()), instead of 6 individual byte assignments. There are other minor optimizations that come in mind, but I am afraid there will not be major improvement - you'd probably need to measure how long each part of the code takes (e.g. duration of the Execution() method calls) to see, where is possible chance of improvement. You can use for example Stopwatch class, but keep in mind the resolution of system timer (~21 µs Netduino gen 1; 1 µs Netduino gen 2). Unfortunately, the interpreter has major performance impact.



#59613 Slow I2C Sensor Reads, is this normal?

Posted by CW2 on 08 August 2014 - 07:07 PM in Netduino Plus 2 (and Netduino Plus 1)

Well, from the above the duration of I2C.Execute() method call is about 40 ms. Thus, even if you were able to consolidate the setup sequence into one I2C Execute() call, you'd still need at least three: setup, status check, data readout and that would be at least 3*40 = 120 ms, which is still 4× slower than Arduino.

 

IMHO the only way to get required speedup is to modify the firmware, i.e. create a native method that does all the I2C transactions to read data from the device.

 

Technical note: The .NET Micro Framework code is so slow in comparison to Arduino not only because it is interpreted, but also because there are several layers of abstraction - in this particular case, I2C methods take hundreds of instructions to execute parameter checking and marshalling, initializing internal structures, moving data forward and backward, mimicking asynchronous behavior using queues and completions etc. I can imagine writing a simple specialized I2C function that will not do anything but direct I2C calls, basically the same what Arduino code does - then it will be at least as fast, more likely faster (limited by I2C communication speed).




#59601 Slow I2C Sensor Reads, is this normal?

Posted by CW2 on 07 August 2014 - 09:11 PM in Netduino Plus 2 (and Netduino Plus 1)

Unfortunately, there are certain areas in the .NET Micro Framework that should have been redesigned, e.g. to support multiple devices...
 
While it is not possible to create second instance of I2CDevice unless you Dispose() the first one, it is possible to have several I2CDevice.Configuration instances and switch among them:
 

// Warning: Code written from head

private I2CDevice.Configuration[] configs = new [] {
  new I2CDevice.Configuration(0x30, 400),
  new I2CDevice.Configuration(0x31, 400),
  new I2CDevice.Configuration(0x32, 400)
};

// Initialize with a dummy configuration, or use any of the above
private I2CDevice mag = new I2CDevice(new I2CDevice.Configuration(0, 0));

...
for(var i = 0; i < configs.Length; i++)
{
  mag.Config = configs[i]; // Select actual device
  runSensor(mag, i);
}

I think there is even a class/library somewhere in the forums... ...I2CBus and probably several  other 'multi' I2C implementations.




#59602 Slow I2C Sensor Reads, is this normal?

Posted by CW2 on 07 August 2014 - 09:14 PM in Netduino Plus 2 (and Netduino Plus 1)

Ok, Spiked just beat me to it.  :)




#59349 Serial Issues

Posted by CW2 on 23 July 2014 - 01:32 PM in Netduino Plus 2 (and Netduino Plus 1)

What cable do you use to connect Netduino Plus 2 to the PC? Could it be faulty (e.g. cheap USB converter)?
 
Also, does the data table in your original message mean that Netduino receives character with ASCII value 6 for the original '0' character, ASCII 103 for '1' etc.? If not, what data are you sending?





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.