01-31-2013 04:20 AM
Hello
I am trying to control five stepper motors simaltaneousy using comapc rio 9074.
I know that 9074 can only use upto 3 DMA channels. I need to pass my data from host to fpga through five different DMA channels as rotation for all motors is at different angle. Is there any method that I can use Five DMA channels with 9074 or any other solution?
When I use only 3 DMA channels it works fine. what I thought was to connect other two motors with any of these 3 DMA channels so not inculding 4th new DMA(by this moving it at same angle used by the motor of that DMA ) but in that case also it says compilation failed due to resource overmapping.
No matter how much I reduce my code it still says this. However when I remove that fourth repeated DMA channel and adding whatever I removed earlier It compiles..
Is it the case that even if I am using the same DMA again its counting it as a fourth one??
But then again by repeating it doesnot says "there are insufficient DMAs" but rather says "compilation failed due to resource overmapping"
What should I do?
Sara
01-31-2013 04:51 AM - edited 01-31-2013 04:51 AM
I have also attached the picture for my FPGA properties. In this it says multi element acess on target not supported.. does this mean that Same DMA for two different motors cannot be used?
Sara
01-31-2013 01:05 PM - edited 01-31-2013 01:05 PM
What data type are you sending to the FPGA through the DMA channels? If you are using something smaller than I64, I would suggest one of two things ...
1. Pack multiple elements into a single DMA element using the join/split numbers primitives. In other words, you're manually creating a set of virtual DMA channels across one physical DMA channel.
2. Time-slice the DMA channel by pushing rotation values into the channel serially. Again, if the motors are all synchronized then you can just push the values back to back (motor 1, motor 2, ..., motor 5, motor 1, motor 2, ...). Or, you can pack both the motor # and the angle into a single DMA element (using split/join) and then forwarding the angle to the correct motor in the FPGA.
Also, in both cases, I would recommend having small, locally defined FIFOs on the FPGA side. Essentially, you have one processing loop reading angles from DMA and shoving the values into the "control stream" for each of the motors. This should help separate the code to make it easier to add more motors and features in the future.
Hope that helps.
02-02-2013 09:22 AM
I am sending my angles for rotation in DBL from host to fpga.
Are you suggesting me these solution for operating all five motors in parallel at different angles?
second option told by you sends data serially does that mean that motors will operate serially that is not all at the same time??
Moreover I havent understood exactly what I have to do! can you please explain me what do you mean by Packing multiple elements into a single DMA element using the join/split numbers primitives??
02-02-2013 09:54 AM
SaraBaber wrote:Moreover I havent understood exactly what I have to do! can you please explain me what do you mean by Packing multiple elements into a single DMA element using the join/split numbers primitives??
Do you really need to use a DBL for your angles? Can you get away with a U16 or U8? The idea there is that you can pack 4 U16 integers in a U64 word. If you can use U8, then that's 8 integers you can use. The idea is that you can pack multiple commands into a single DMA element. You use the join numbers primitive to create your word in the PC and the splilt number primitive to separate it back out on your FPGA.
SaraBaber wrote:second option told by you sends data serially does that mean that motors will operate serially that is not all at the same time??
"Same time" is really kind of relative. Your FPGA should be cycling fast enough that you will not notice any skew time between the commands going to your different motors. You have a couple of options when using the single DMA here. You can rotate through which motor gets a command. Or you can add a byte to the element to tell which motor gets the command. Again, do you really need to use a DBL?
02-04-2013 04:40 AM
HI
I am attaching my code here so that you can have a look. No using DBL s not necessary I can use 16 bit or 8 bit interger too for this purpose.I dont think that will create any problem. Can you please tell me how to make packing of 4 U8 and pass to single DMA ?? If you can have a look at my code and tell me how to do that will be helpful.
In this code I am actually using 3 DMAs to operate 4 motors right now.
I am entering my angle value in RT vi and that is passed to FPGA. However as I am not allowed to use more than 3 DMAs with 9074, therefore right now for the fourth motor I am using DMA channel that is same for 2nd motor . So for that actually both motors operate at same angle.
Please have a look.thanks alot!
I am waiting for response
02-05-2013 04:05 AM
Hello
I am trying to use the concept of interleaving and decimating arrays but its always giving me the data type error when I am using it!
Moreover do I have to use split/join number fuctions with this too?
Thanks
02-05-2013 07:10 AM
SaraBaber wrote:Can you please tell me how to make packing of 4 U8 and pass to single DMA ??
Well, if you are representing your angles as 8-bit integers, make your DMA a U32. You can use the Join Number (you will need 3 of them) to combine the U8s into a U32. You can then just send that U32 down the DMA. On the FPGA side, you just do the opposite (use Split Number, again 3 of them) to get your angles out. If you need more than 4 motors, go with the U64.
02-05-2013 10:39 AM
This technique of split/join number cannot be used in my case. As you can see in my RT vi that I am getting my data from calculate move profile function (of softmotion)
so its not accepting the join number function!, to send data into fifo write as they have different types and I cannot change the type of any of them(to my knowledge)
What should I do in this case??
I have attached the picture. please have a look!
Thanks
Sara
02-05-2013 11:43 AM
I have been trying to use the concept of interleaving and decimating the array with this.
The example i found here is however form fpga to host. I want it from host to fpga. I did this but in fpga side when I connect my FIFO element with decimate 1D array its says different data type. however in the example given by NI they are connected. how come this is possible.
P.S: we cannot change the data type of FIFO to array!
Thanks
. the link refferd is below
http://zone.ni.com/reference/en-XX/help/371599G-01/lvfpgaconcepts/fpga_dma_fifo_interleave/