Sammy C21 and servo control
-
This has been a bad weekend so far for my Sammy C21 board escapades. First, I can't get the voltage monitoring to work, then I can't figure out the serial debug printing and now, the Servo control isn't working as expected. I need a break from this thing.:-)
Anyway, I have a micro servo control hooked to the PA04 pin
{ TcOutput::none, TccOutput::tcc0_0E, AdcInput::none, AdcInput::none, SercomIo::none, SercomIo::none, 4, "pa04" }, // PA04 Servo
The servo is a MG90S microservo and by the way the Sammy C21 is run at 3.3V.
It's configured with (top row):
M950 S0 C"124.pa04" Q50 M950 S1 C"io2.out" Q50
The bottom row is when it's connected directly to the mini5+.
Running simple M280 P1 S90 etc works perfectly when I have it connected to the mini5+ but it doesn't move at all if I don't inject 3.3V to the signal with the Sammy when running the same with P0.
When I inject 3.3V it's extremely jittery as if the signal isn't holding.
Any ideas?
-
@gixxerfast which firmware on the duet and which on the sammy or more which firmware is the sammy fork based?
Rrf changed some servo stuff with 3.4 b7
-
@pcr They are both the latest AFAIK but I haven't kept up with the latest on the forum. The mini5+ is on 3.4.0beta7+7 and the Sammy is the absolutely latest 3.4-dev named 3.4.0beta7+8. For the Sammy there's no late commits I could see that would affect servos (I think).
I have compiled the latest firmware from 3.4-dev for the 1LC as well. Of the configurations below, only the Sammy doesn't work.
M950 S0 C"124.pa04" Q50 ; Sammy C21 board M950 S1 C"io2.out" Q50 ; Duet3 mini5+ M950 S2 C"121.io0.out" Q50 ; 1LC Toolboard
-
As an update, I have changed the 10K pullup resistor to a 4.7K between 3.3V and pa04 and now it works better but still a bitt jittery.
If I run the stepper motors, then afterwards it's not possible to run the servo anymore until I reset the board.
The 1LC has a 5V io0.out signal so that works without any problems. The Duet mini5+ do have 3.3V gpio signals (AFAIK) but they must be higher/"stronger" than what the SAMC18G can produce on 3.3V.
I can note that even when running via the 1LC or the mini5+ I power the Servo via my board, so the supply is good.
-
@gixxerfast according to https://www.electronicoscaldas.com/datasheet/MG90S_Tower-Pro.pdf the R90G is a 5 V based servo (starting at 4.8 V), so I would decouple Sammy from it by using a level shifter and use a dedicated 5 V source for the servo. There were a few discussions here about hobby servos, e.g. https://forum.duet3d.com/topic/24939/hobby-servo-wiring
-
@joergs5 Yes, I've come to that conclusion also. But I need to understand why it's not working correctly right now before I make any further changes.
The board is simply a Duet adaptation of the Klipper based ERCF Easy brd (multifilament filament feeder) and there they are using a Seeeduino XIAO which has as I understand it a SAMD18G. They are feeding this micro servo 3.3V signal and it seems to work reliably.
My board has a separate 5V voltage converter.
Now, the main culprit here seems to be my pullup for the driver UARTs (4K7 to 3.3V) and when that's used the servo signal isn't working anymore. I've added a 100nF decoupler but that doesn't help. If I add another pullup to the servo signal line then it works, but jittery.
Unfortunately the TMC2209 step sticks has a 10K pulldown on the UART pin.
-
@gixxerfast I am confused what you are using and at which pins.
Especially "Unfortunately the TMC2209 step sticks has a 10K pulldown on the UART pin." => do you use the uart pins of the ERCF??I would check that
- all ground are connected, so the signal is well defined
- the jittery line doesn't have other signals on the line
- current is enough
- no flow back from 5V to 3.3V
The L7805 in the schema is 5 V. => the servo connector is 5V in the schema. Did you use this connection J1 ?
-
@joergs5 said in Sammy C21 and servo control:
@gixxerfast I am confused what you are using and at which pins.
Especially "Unfortunately the TMC2209 step sticks has a 10K pulldown on the UART pin." => do you use the uart pins of the ERCF??I would check that
- all ground are connected, so the signal is well defined
- the jittery line doesn't have other signals on the line
- current is enough
- no flow back from 5V to 3.3V
Yes, I use UART to communicate with the "smart drivers" TMC2209. That connects from TX (PA22) & RX (PA20) of the SAMC21G to pin 14 on the BTT TMC2209 step stick. There they have added a 20K pulldown instead of what Duet uses a pullup. So I got the advice from DC42 to try a 4.7K pullup to counter the effect of that.
My board uses a LMP78 1.5A 5V that's used to power the Sammy C21 and to power out to the Servo
-
@gixxerfast said in Sammy C21 and servo control:
The board is simply a Duet adaptation of the Klipper based ERCF Easy brd (multifilament filament feeder) and there they are using a Seeeduino XIAO which has as I understand it a SAMD18G. They are feeding this micro servo 3.3V signal and it seems to work reliably.
My statement was about this sentence. I think the ERCF is using 5 V for the servo and this is the reason why it works:
The SERVO gets 5V from DCDC-5V L7805, and the signal from the Seeeduino.
-
@gixxerfast said in Sammy C21 and servo control:
My board uses a LMP78 1.5A 5V that's used to power the Sammy C21 and to power out to the Servo
This is what I don't understand: where is the servo connected and how is it related to the UART of the TMC2209?
-
@joergs5 Which is what I wrote above :
My board uses a LMP78 1.5A 5V that's used to power the Sammy C21 and to power out to the Servo
The signal comes form the Sammy.
-
@joergs5 said in Sammy C21 and servo control:
and how is it related to the UART of the TMC2209?
This is the main question. They should not be related IMO, but they are. The need to pull upp the signal for the driver UART somehow disturbs the Servo signal from PA04.
Now when I have removed the pulldown on the step stick and also then the pullup on the UART line, the Servo can be controlled nicely. However I still don't understand how this is related to each other.
-
@gixxerfast one possibility how they could be related is that the current in total is too high. (And if it's too high, there is also a risk for damage). Can you measure the currents?
-
@joergs5 No I can't. I have simulated it in ltspice, but that's a very simplified model, and there the currents are very low. Though I don't know how the TMC2209 behaves.
I should have about 250mA to play with and I'm thinking that if the Seeeduino XIAO can handle it, then the Sammy C21 should also. The Seeeduino 3.3V LDO can only deliver a max of 200mA and then it has to power the SAMD18G as well.
-
@gixxerfast I just checked how much the SG90 draws, in stall maximum 0.7 A *), so in total with the other components maybe 1.5 A is not enough.
*) according to https://protosupplies.com/product/servo-motor-micro-mg90s/
-
@joergs5 No I don't think so, it should be quite enough. It's not like I'm stalling the Servo yet anyway.
I'll just leave it for a while again.
-
@gixxerfast good luck, I hope you find the reason. I have the Sammy-C21 also, but have to install the firmware first.