I’ve started a new project with .NET Gadgeteer and I planned to use the Hub AP5 Module to control a 4 Relays (Y Shocket), a Motor Driver L298 (P Shocket) and a OneWire X1 (XY Shocket) modules connected to a Spider mainboard.
I’ve had a lot of problems with Motor and OneWire modules only when connected to the Hub AP5.
In the case of OneWire X1 Module it send a initialization error and in the Motor Driver module, it doesn’t regulates properly the motor power (don’t work under 50% values and when put 100% value in code, actually it only reacher an 70% equivalent power output -I’ve analyzed it with a O’scope-).
I’m using MF 4.2 and the last stable versions of Gadgeteer and GHI SDK and Firmware/Tiny Booter.
I think it has trouble managing interrupts but don’t know how to manage and solve this problem.
I’ve captured the signals of the motor output with a oscilloscope and the results were absolutely different showing a complete loose of motor control in the second scenario.
No current pass to the motor until you are above 25% and it don’t increment power above 75% of power even if code sais it could be 100%.
I’ve tested it with two different Hub AP5 modules and also with two different MotorController modules so it is very difficult that the problem was a fail in the modules hardware.
If you need more information I could try to obtain more data in order to make the system working correctly.
@ magustin - the problem is that the default clock source we use for the chip on the hub is inadequate for higher PWM frequencies that require more precise duty cycle resolution like the motor controller. In fact, at the 25KHz frequency that the motor controller uses, the chip only allows around 0%, 33%, 66%, and 100% duty cycles, which is what you see. The driver does not currently support using the other available clock sources to generate the signal, but it’s something we’ll look into it.
That said, you can manually add the driver for the Hub AP5 to your project and switch to a different clock source as a work around. You’ll want to reference the datasheet for the chip, it’s the CY8C9560A chip from Cypress. Take a look at the Period, Pulse Width, and PWM Clock Sources registers on page 13. You’ll see that we are using 93.65KHz in the driver. The 1.5MHz clock will give you 60 duty cycles (0%, 1.666%, 3.333%, 5%, 6.666%, …) when using the 25KHz frequency in the motor controller. If you change to that clock, you should have better control.