Guzunty / Pi

This repository contains resources to support the Guzunty Pi IO expansion board
110 stars 32 forks source link

new core: standard server driver with 8 or 10 bit resolution #17

Closed heppg closed 11 years ago

heppg commented 11 years ago

Hello, driving standard servo need pwm with 50 Hz; 1ms pulse at value 0; 2 ms pulse at 255 (or 1023, using 10 bit). Writing values to the pulse driver should only occur in 'low' time, so no wrong pulses can occur. This requires extra latches for incoming values. Communication to processor by SPI. Clock input from GPIO 4, frequency 50Hz * 20 * 256 (8 Bit, 1024 on 10 Bit). This requires a divider of 75 for the 19.2MHz Osillator.

4 Channels would be great, could possibly be achieved with 8 bit resolution. 2 Channels at 10 Bit ?

Greetings Gerhard

campbellsan commented 11 years ago

Hi Gerhard,

What you are describing sounds very close to the already existing core, gz_4s8o8i, at least for 8 bit support.

Could you look at that and tell me if it does what you have in mind? Or if not, please could you enumerate what the required differences would be?

Creating a 10 bit gz_2s variant from this existing core would be quite easy. I already know from experiment that more than 2 10 bit channels is probably not possible in 72 macrocells. Too many bits to cache, if I remember correctly.

HTH,

Derek

campbellsan commented 11 years ago

Another thought Gerhard,

Have you looked at Servo Blaster? It is a software only servo control solution.

If a Guzunty based hardware implementation is preferable, I'd be curious to understand why.

best,

Derek

heppg commented 11 years ago

Servoblaster is close to what I need. The only drawback is the resolution of 10us, which gives 100 Points in 1 ms and is lower than the 256 Position resolution which would be nice. But not bad. Your existing cores have 256 Bit resolution for PWM 0% to 100% (hope I understood this right). Perfect for dimming a LED, but as a servo effectively only use 1ms out of 20ms period time to set the position, the servo resolution is 256/20 = 12.8 positions. Greetings, Gerhard

campbellsan commented 11 years ago

Yes, Guzunty can do better than 10us resolution.

I recommend you look more closely at the existing core I mentioned. The cores which offer 256 bit resolution 0% to 100% are labelled with the 'p' designation. These give a simple PWM pulse width from all off to all on in 256 steps. As you say these cores are indeed designed for driving LED's and motors.

The 's' designated core is different. It is designed specifically to drive servos. It gives a 1ms - 2ms pulse width in 256 steps. My current understanding of your requirement is that this one will meet your needs. If this is so, then creating a 10 bit variant is definitely possible.

heppg commented 11 years ago

Yes, you are right. I did not notice this one, which is perfectly the one I looked for.

I have a closed loop experiment here, where I drive a mechical device with a servo, and currently the accuracy of the mechanics highly depends on the servo resolution. I'll give it a try, but may last some time, as I am busy with preparations for an raspberry afterschool workshop which is starting in a few weeks. Last not least: The CPLD is a good idea, your documentation and software are great and I had my kit working with no problems.

Greetings Gerhard

campbellsan commented 11 years ago

Thank you for the feedback Gerhard. Since you found a core that meets your needs, I'm going to close this issue. If you should find that the standard core needs any modification please feel free to reopen it.