Hello everyone! I'm new with XCore and I'm looking for some XCore that provides my needs. I need to control several Servo Motors and to do that I need a lot of PWMs signals. I'm not sure if I can use the PWM signals that appears in the XS1-A8A-64-FB96-Datasheet. From page 74 to page 81 it shows two pins for PWM modulation in Jumpers 4 to 10.
The question is, Can I use this PWM's signals in the startKIT? Or I need to build my own board with an xCore?
Appreciate your help!
This is the Datasheet url:https://www.xmos.com/download/public/XS ... 1.3%29.pdf
PWM pins in jumpers
-
- Junior Member
- Posts: 4
- Joined: Wed Nov 19, 2014 7:37 pm
-
- XCore Expert
- Posts: 754
- Joined: Thu Dec 10, 2009 6:56 pm
The PWM references in the datasheets are about the PWM mode of the internal switching voltage regulators. They have nothing to do with regular PWM outputs.
With XMOS you usually implement your peripherals in software, including PWM.
You can use any port for it.
You may want to take a look at https://github.com/xcore/sc_pwm
With XMOS you usually implement your peripherals in software, including PWM.
You can use any port for it.
You may want to take a look at https://github.com/xcore/sc_pwm
-
- Junior Member
- Posts: 4
- Joined: Wed Nov 19, 2014 7:37 pm
I read it before but I didn't understand very well how it worked, and it looked a bit strange for me that you could configure any pin as a PWM. But I don't understand when, in the readme file, says:
"PWM single bit component generates PWM signals on up to 16 1-bit ports from a single thread"
"PWM multi bit component generates the PWM signals on a single 4, 8 or 16 bit port."
What does it refer with PWM single bit and multi bit??
Thanks!
"PWM single bit component generates PWM signals on up to 16 1-bit ports from a single thread"
"PWM multi bit component generates the PWM signals on a single 4, 8 or 16 bit port."
What does it refer with PWM single bit and multi bit??
Thanks!
-
- XCore Expert
- Posts: 754
- Joined: Thu Dec 10, 2009 6:56 pm
Unlike the average microcontroller, XMOS processors only have general purpose I/O (not counting ADC, and built-in USB in the newer chips). The physical I/O pins of a chip are multiplexed to ports.
These ports what you work with in the software. A port has a certain width, this can be 1, 4, 8, 16, 32 bits wide. Each port has a timer and you can also use clock blocks for more sophisticated timing behaviour. Add to this that ports can buffer (serialise / deserialize in the case of 1-bit width) incoming and outcoming data. Using these features one can implement sophisticated timing-accurate interfaces in software with low CPU usage (it is not bit-banging!).
These ports what you work with in the software. A port has a certain width, this can be 1, 4, 8, 16, 32 bits wide. Each port has a timer and you can also use clock blocks for more sophisticated timing behaviour. Add to this that ports can buffer (serialise / deserialize in the case of 1-bit width) incoming and outcoming data. Using these features one can implement sophisticated timing-accurate interfaces in software with low CPU usage (it is not bit-banging!).
-
- Junior Member
- Posts: 4
- Joined: Wed Nov 19, 2014 7:37 pm
So I can work with several PWM signals with 1-bit width, isn't it?
And I suppose that the number of different PWM signals that I can run in parallel will depend on the ports that I use. Then, in J7 Header GPIO, different Ports are: P1F0, P1H0, P1G0, P1E0, etc. (P4C0 and P4C1 are the same I suppose), that means that I can run all that PWM signals?? Or each port is specified by its number (P1, P2, etc.)?
I haven't got the time to read the sc_pwm, but I suppose that it specify how to control a 0-100% PWM signal in 1-bit width.
And I suppose that the number of different PWM signals that I can run in parallel will depend on the ports that I use. Then, in J7 Header GPIO, different Ports are: P1F0, P1H0, P1G0, P1E0, etc. (P4C0 and P4C1 are the same I suppose), that means that I can run all that PWM signals?? Or each port is specified by its number (P1, P2, etc.)?
I haven't got the time to read the sc_pwm, but I suppose that it specify how to control a 0-100% PWM signal in 1-bit width.
-
Verified
- XCore Legend
- Posts: 1140
- Joined: Thu May 27, 2010 10:08 am
What PWM spec do you need - like any PWM source there is a tradeoff between bit depth and frequency. Some of the IP also has a tradeoff between channel count (for a single core function generating multiple PWM).
Also checkout http://www.xcore.com/questions/2848/i-require-8-pwm for an alternative.
PWM in XMOS is software driven with backup from some nice port features (buffers, serialisers, timers) and there are many ways to generate PWM, each with thier own pros and cons.
Knowing what it is you want to generate (channels, resolution, frequency, buffering, alignment..) and to drive what (LEDs... motors.. Servos etc.) would be useful so we can help point you at the right implementation.
Yes - there is IP to do that.So I can work with several PWM signals with 1-bit width, isn't it?
- hmm, well I guess that's your choice. At least have a look at the header files and the app_pwm_xxx examples before you use it.I haven't got the time to read the sc_pwm
Also checkout http://www.xcore.com/questions/2848/i-require-8-pwm for an alternative.
PWM in XMOS is software driven with backup from some nice port features (buffers, serialisers, timers) and there are many ways to generate PWM, each with thier own pros and cons.
Knowing what it is you want to generate (channels, resolution, frequency, buffering, alignment..) and to drive what (LEDs... motors.. Servos etc.) would be useful so we can help point you at the right implementation.
-
- Junior Member
- Posts: 4
- Joined: Wed Nov 19, 2014 7:37 pm
I want to generate at least 3 PWM signals that runs in parallel to control multiple servos. What I want to make is that, first, 3 servos runs at the same time to different positions, and then, other 3 different servos runs at the same time to different positions. When I mean different positions it involves that each servo needs a different PWM signal. The Servos are analogue and the position change between 0 and 180 degrees.infiniteimprobability wrote:Knowing what it is you want to generate (channels, resolution, frequency, buffering, alignment..) and to drive what (LEDs... motors.. Servos etc.) would be useful so we can help point you at the right implementation.
Thank you very much for your help
-
Verified
- XCore Legend
- Posts: 1140
- Joined: Thu May 27, 2010 10:08 am
Ahh - right. Well servos are very low speed things to be driving, so no problems. Users have been able to drive 32 channels of servo from a single port/core easily.
Here's the general idea:
To be honest, this would be a very simple thing to do from scratch. Eg. 3 x 1b ports with timers. Or even a 4b port with 4 timers (one to reset and the other 3 for the transition).
Luckily plenty of users have done this before.. This is a really nice, straightforward example
https://www.youtube.com/watch?v=iqdLpQFa2MQ
http://www.xcore.com/projects/simple-servo-control
so you can use that to get going..
Here's the general idea:
To be honest, this would be a very simple thing to do from scratch. Eg. 3 x 1b ports with timers. Or even a 4b port with 4 timers (one to reset and the other 3 for the transition).
Luckily plenty of users have done this before.. This is a really nice, straightforward example
https://www.youtube.com/watch?v=iqdLpQFa2MQ
http://www.xcore.com/projects/simple-servo-control
so you can use that to get going..
-
Verified
- XCore Legend
- Posts: 1140
- Joined: Thu May 27, 2010 10:08 am
Here's an updated library and example if you want to re-use rather than write your own:
http://www.xcore.com/projects/simple-servo-driver
http://www.xcore.com/projects/simple-servo-driver
-
- Member++
- Posts: 31
- Joined: Mon Jan 20, 2020 9:54 am
Hi there !The links provided by infiniteimprobability are not working.
http://www.xcore.com/projects/simple-servo-driver
http://www.xcore.com/questions/2848/i-require-8-pwm
is there anyway i can get some info regarding those.
would be much appreciated.Thanks
http://www.xcore.com/projects/simple-servo-driver
http://www.xcore.com/questions/2848/i-require-8-pwm
is there anyway i can get some info regarding those.
would be much appreciated.Thanks