ni.com checkout is currently experiencing issues.

Support teams are actively working on the resolution.

Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

More myRIO PWM outputs via FPGA

I'm working on a project with the myRIO that requires 9 servo PWM signals. I know that the PWM Express VI operates on 8 different pins among the 3 connector ports on the myRIO. After spending a few hours researching FPGA, I was getting no where since a lot of it is beyond my skill level/understanding. 

 

So my question is: what is the simplest way to create more PWM signals with controllable duty cycles on the myRIO FPGA? I wanted to have all the servos attached to pins on one connector for simplicity (e.g., all on MXP-A).

 

My initial thought was to create more instances of the DIO/PWM mappings under MXP-A in the shipping personality. But then I had a vague feeling that this segment of the VI makes these pins compatible with the PWM Express VI and doesn't actually produce PWM signals. Is that what this does? Or is it possible to make copies of this and rename the registers PWM.A_3..., PWM.A_4...., PWM.A_5..., etc.?

DIO-PWM.JPG

I looked at PWM Output With LabVIEW FPGA, but that didn't make any sense to me considering it has no documentation. I also found Developing a PWM Interface using LabVIEW FPGA, but I couldn't see a simple way to adapt it to my needs, while keeping the standard functions of the pins on the other connectors.

 

Thanks.

Bob

 

 

 

 

 

0 Kudos
Message 1 of 6
(11,561 Views)

Hey,

 

First, check out my post here marked as the solution.

 

The FPGA code is the actual I/O (you can think of it as the hardware).  This does not update the Express VIs though (more about that in the post linked above).

 

Let us know what questions you have after reading the above.

 

Thanks!

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 2 of 6
(11,557 Views)

Sorry for the delay Sam. I figured out how to add the PWM outputs via FPGA and it works. Then I tried to accomplish this while still retaining the functions of the other connectors. My method was to go into the FPGA personality and replace all of DIO-A's FPGA with my PWM code while keeping all of the FPGA code for the other connectors intact. The files are attached.

 

My issue is: in RT Main, I also tried to run something from the MXP-B connector (PWM Express for example) in a parallel while loop while still running my custom PWM on MXP-A. This produced nothing. I read the PWM Express signal on B/AI0 and it was a flatline at zero. However, when I created a new VI that just uses PWM Express on MXP-B, it works fine.

 

Is there a reason why the express VIs aren't working on the other connectors simultaneously?

 

Thanks,

Bob

Download All
0 Kudos
Message 3 of 6
(11,498 Views)

Hey rw378,

 

Can you post the RT code that does and does not work.

 

Does the Express VI throw an error?

 

Thanks!

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 4 of 6
(11,492 Views)

Attached is the whole project. I forgot I deleted what didn't work from that VI I previously posted.

 

The PWM Express VI in the bottom loop of RT Main does not execute (as show by a probe on the wire between slider and express VI). However, simply running MXP-B_test.vi (which doesn't involve using the custom-made FPGA PWM pins on MXP-A) works fine. 

0 Kudos
Message 5 of 6
(11,487 Views)

Hey,

 

I bet the Express VIs are generating errors.  Try connecting an indicator the the error terminal of both express VIs to see if they generate errors when run.

 

My guess is that you're opening a connection to the FPGA which returns a reference.  The Express VIs have no idea that you did that, and then when they try to open a connection to the FPGA it fails because there is already an active connection. 

 

You should be able to fix this using the Set Custom Bitfile VI on the myIRO>>Utilities palette to set the bitfile ref to be used by the express VIs.  You'll need to make sure you call that VI before calling any other myRIO VIs.

 

Let us know if that helps.

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

 

0 Kudos
Message 6 of 6
(11,455 Views)