This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello. I was wondering if it is possible to control a pin via the PWM functionality of a timer without setting PxSEL |= BITn? I have a pin that I would like to control via PWM, but it is not connected to a timer module, like TAx.n. I am using the MSP430FR5725. The pin description is "PJ.0/TDO/TB0OUTH/SMCLK/CD6".
I'm a bit of a beginner with MSP430 myself but I see your post has had no responses yet, so this might help (or stimulate some more responses).
Generally I think it is not possible to do what you are asking. Most microcontrollers have a number of pin options for given peripherals. These options are constrained by the routing of the circuitry formed in the silicon structure of the chip. To allow any peripheral to be routed to any pin would make for an overly complex routing structure, so options are limited to a few pins. The pin you want to use can be used for a general digital I/O but can be alternatively used for the other functions listed in the pin description - you must set the micro up so the correct peripheral is routed to the pin (PxSEL). As there is no silicon structure inside to permit a timer to be routed to that pin, you cannot do what you want.
Your options are to swap pins around so that you can use one that can output a PWM signal or, if software overhead/timing is not an issue, attempt to implement one in software. Tables 12 to 16 in the data sheet show the pin numbers that can be used for outputs from timers.
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
(With due respect to the prior poster,) This is certainly possible. Search the Forum (or Google) for "software PWM"
The idea is to mimic the function of the hardware PWM in software, which is actually not so complicated. Store the "CCR" value in memory, set up your timer to trigger on "match" and "overflow", and wiggle the GPIO pin directly in the ISR. If (big "If") that's All your program is doing, you might get a better waveform using software delays rather than an ISR. As you search, you'll find examples of doing this for multiple channels.
The results won't be as accurate as those of hardware PWM -- you'll have jitter proportional to your interrupt latency. It will cost you some CPU time, and there will be a lower bound on your period and duty cycle. However, it will be quite adequate for many applications.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.