• 0
Sign in to follow this  
fpgauser

motor controller with BASYS3 and UART

Question

Hi everyone, 

I am working on a project about drone. The project is sending and receiving data through UART and controlling the four brushless servo motors by getting these value for the speed of servo motors. I could find and combine codes for accomplishing the communication between fpga and the computer. However, I cannot make a relationship between coming data with servo motor. I get the coming UART data one by one by converting integer for duty cycle. Could you help me out this, how can I get the received data and send it to servo motors?

Thanks in advance.

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

@fpgauser,

I'm not sure I understand your question.  I may need you to explain it some more.

From what I understand, you are reading the motor's speed within your FPGA, sending that value over UART to a PC/host, and then trying to adjust the motor's current as a result.  And .... you are struggling with the fact that UART communications have a delay associated with them, with the delay between when they are sent and when you read them, or some such?  (I trust you've put the terminal into raw mode, instead of cooked, so that it isn't waiting on line feeds ... right?)

I guess my first thought would be .... why use the UART at all?  One of the reasons for using an FPGA in the first place is that you can control the timing between events, and even better that you can guarantee a particular response time or times.  Computers, whether on the FPGA or connected to the FPGA, don't usually have predictable response times.

Dan

P.S.  Looks like I may be doing a brushless DC motor problem of my own later this year.  The hardware is now on my desk already, although I don't have the schematics for it yet.  I'm just saying this because I'm curious about anything you might wish to share.

Share this post


Link to post
Share on other sites
  • 0

Actually the reason for using fpga with UART is that this project is all about control a diy drone. In other words, rotors of drone could take by their value through UART and the whole programming language is in VHDL. This is why I am using BASYS3 with UART, an embedded systems could handle the project after compiling the code. But I cannot send the values that I entered by UART using TERA TERM to servo motors in this code, and I don't know how to handle because things are seemed okay, the loopback that I wrote for UART  for sending and receiving the values couldnt rotate the motors the way I wanted, there are only little vibration on the motors whatever I enter values.

Thank you for your attention. 

Share this post


Link to post
Share on other sites
  • 0

@fpgauser,

I'll offer what help I can:

  1. UART is inappropriate for controlling a rotor's rotation on a rotation by rotation basis.  It might work well for controlling a controller, but not for communicating the control signals to the rotor.  So, for example, I would have no problem with connecting a joystick to a computer and sending its values via UART to a rotor controller.
  2. Some time ago, I wrote about how an FPGA could be controlled via a UART port through software.  You can read about the hardware interface here, and a discussion of the software interface here.  You might find this approach valuable, even though all of the examples are in Verilog.
  3. Controlling a real-time device, such as a rotor, which requires inputs and outputs faster than a UART can manage them, creates another problem: how do you discover what's going wrong within your design?  For this reason, I discussed how to place a scope within a design.  Such a scope can record a certain amount of values, rarely enough, but at high speed.  This can then be used to find and recover from any problems you might have.

If this doesn't help (and I sort of doubt it will), then can you please be more specific about the problem you are having and what help you would like?

Dan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this