2009/2/17 Sebastien Lelong <[email protected]>:
> Hi,
>
> So, if I understand, using non-blocking delay is not the best way to do this
> at all. If we use blocking delays ("normal" delays), and ISR for serial or
> i2c, buffer the received commands, and process them when possible (pwm is
> low), questions now are:
>
>  - what if all servos are at max position ? This means no pwm low... so no
> time to process buffered commands.
the 20 ms is not critical, so I expect this won't be a problem.

>  - postponed the received command processing might be overkill. What will be
> the process ? Probably few assignments. Expect maybe when accessing EEPROM.
> Buffering commands is probably not useful.
I think this might not be possible - if you wait 2.5ms you block the
i2c bus or get usart overrruns...

>  - when receiving something, this will potentially interrupt pwm while high.
> This is the problem you talk about. Let's consider 10µs is long enough to
> have impact on position, as you say. This means under 10µs, it's acceptable.
> At 20MHz, this is 50 instructions. Could receiving a char through i2c is
> done within 50 instructions ? What about serial ? I need to count...
I have not determined the exact value that is acceptable and this
might vary from servo to servo. It is my experience that I hear the
servo every few seconds when i2c is on...

>
>
> If we go as you suggest, that is: use ISR for PWM (how ?), polling for
> i2c/serial:
Set the output high and program a timer to generate an interrupt when
the desired time has elapsed.

>
>  - will we miss commands ? For i2c, will the master wait for the slave
> before sending a new byte ? For serial, I think it must be possible to loose
> chars.
You need something to detect if you lost a char since you don't want
to process an incomplete frame.

>My opinion is, for serial, it's acceptable, because i2c is better for
> this kind of application (addressable, do use usart often used to
> communicate with a PC). Serial is useful to get started, to debug.
Okay, if it is for debug only.

>  - if we can potentially miss commands, even using i2c, the controller
> should be able to send ACK (not i2c ACK, but application ACK), so the
> client, errr... the master knows if it's ok, and re-send commands as needed.

But... I don't think we need to loose chars this way. The only thing
we have to do is poll i2c and serial. I guess these two flags can be
polled every 2 usecs or so and only when there is a timer interrupt,
it takes a few us more.

>
>> > About PWM software, it should be possible to extract pwm_software.jal
>> > library for this. Can be useful in many, many other projects.
>> ??? I don't understand what you try to tell us.
>
> Since this is about having lots of PWM channels, and since common PICs only
> have one, maybe two channels, PWM must be implemented in software.
> Implementing a PWM software channel something usual, I can remember lots of
> projects when I do this, just because one PWM channel isn't enough. So,
> having a flexible, powerful lib, dedicated to PWM software channel
> implementation would be great. On this servo controller, but also on many
> other projects.
This sure would be nice!

Joep

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to