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

XBee PWM Failed Allocation for 5 Blocks


Best Answer sjmill01, 13 June 2015 - 03:29 PM

I bought me an oscilloscope.

 

I found that the RC PWM which worked great with the Netduino was only 50Hz, versus 15kHz of the XBee PWM output.  So, its definitely what we thought.  The XBee is too fast.  My only option may be using a capacitor to covert PWM to a voltage.

 

See ya',

Sean

Go to the full post


  • Please log in to reply
4 replies to this topic

#1 sjmill01

sjmill01

    Advanced Member

  • Members
  • PipPipPip
  • 45 posts
  • LocationSouth Carolina

Posted 10 May 2015 - 01:14 PM

I previously had an RC receiver wired to pin 7 of my Netduino Plus 2 so I could control motors with software using input from an RC transmitter and additional overriding sensors.  This worked great.

 

I've elected to go away from RC control to a custom made XBee joystick controller so that the controller can be a much smaller and fit into my coat pocket.

 

When I hook the XBee's PWM output to an LED, the LED dims and brightens as expected.

 

When I wire the XBee's PWM output to the Netduino Plus 2 pin 7,I get the Failed Allocation for 5 Blocks warning repeatedly.  In turn, the debugger no longer outputs any debug.print commands in its output window and in a few seconds it crashes with the Out of Memory error. 

 

The XBee outputs PWM for 64 microsecond pulses 1023 times a second.  I adjusted that on the XBee to 50% output and tried again but get the same result. 

 

Could it be that its just pulsing so fast that the interrupt line is getting interrupted as well?  Is there a workaround?

 

 

 



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 May 2015 - 06:46 PM

Hi sjmill01,

Based on your observations, My first guess is that the PWM pulse is queuing up so many interrupts that you're running out of memory.

If you slow things down, does everything work fine?

If you simply read from an InputPort in a loop instead of using an InterruptPort, does that work well for your application?

Chris

#3 sjmill01

sjmill01

    Advanced Member

  • Members
  • PipPipPip
  • 45 posts
  • LocationSouth Carolina

Posted 10 May 2015 - 09:08 PM

I haven't found a successful command to slow down the XBee's PWM, yet.  I'm surprised that I never had any problem using interrupts with an RC receiver's PWM in the past, but it must be that the XBee PWM period is just a little over the top.

 

I found that I can convert the PWM to a voltage using a resistor and capacitor and then I can just simply read the voltage on an analog pin.  This will probably be a fine approach...just a little more hardware to put under the hood.

 

I'll first attempt to find a way to slow down the PWM as I have a ton of code already written for that.

 

Thanks,

Sean



#4 sjmill01

sjmill01

    Advanced Member

  • Members
  • PipPipPip
  • 45 posts
  • LocationSouth Carolina

Posted 10 May 2015 - 11:58 PM

Okay, I tried having a dedicated thread to poll the pin and use DateTime.Now.Ticks to compare the leading and ending edge to calculate the duty.  The values are varying to the point that I believe it is missing the edges here and there.  If I were to use this, my R2D2 would be very jerky in movement.

 

It must be that the XBee has a period that is much quicker than my Turnigy RC receiver as I never had trouble with PWM and a NP2 before.  So, I'll go the route of adding a resistor and capacitor to line out a voltage from the XBee PWM.  That should be reliable.

 

See ya',

Sean



#5 sjmill01

sjmill01

    Advanced Member

  • Members
  • PipPipPip
  • 45 posts
  • LocationSouth Carolina

Posted 13 June 2015 - 03:29 PM   Best Answer

I bought me an oscilloscope.

 

I found that the RC PWM which worked great with the Netduino was only 50Hz, versus 15kHz of the XBee PWM output.  So, its definitely what we thought.  The XBee is too fast.  My only option may be using a capacitor to covert PWM to a voltage.

 

See ya',

Sean






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.