I'm kind of stuck with trying to get a simple PWM out of P71/MTIOC3B with an RX13T,and reading the hardware manual "R01UH0822EJ0100 Rev.1.00" didn't help me to get it working.
Below I describe what I was thinking and how I tried. Can someone help me to get it working, orexplain why it can't work?
Of course there is not a standard way to do this, as 19. Multi-Function Timer Pulse Unit 3 (MTU3c) says:
Because I'm using PB7/MTIOC3C as RxD1-pin the obvious choice seemed to simulate PWM as follows:
Several problems had to be overcome, apart from the obvious PDR-bit to 1, PFS-function to 1 and PMR-bit to 1:
After setting a bit in the first and clearing a bit in the second register I got one change in output, as expected,but no interrupt to get it back. When using high-toggle as MTIOC3B-setting I could verify that the counter wasreset by changing the TGR3C-setting to change the output frequency, but no interrupt.
At this moment I have no clue why the interrupt doesn't happen and the day I thought would be well enoughfor getting it working has passed without the pin working as expected.
What did I do wrong, or is it just not possible with that pin?
I've found out how to have a simple PWM on any of the MTU3- or MTU4-pins.Spending the weekend on testing all kinds of settings, the conclusion is that a single PWM or some combinations of multiple simple PWM's are possible in the following ways on the MTIOCxy-pins (x from 3 4) (y from A B C D):
With solutions 2 and 3 there is only 1 period setting, as if it was PWM mode 2,in MTU3.TGRA, but the advantage is that no interrupt is needed for generating the PWM-output, so precision gains and less software-overhead during the PWM.
When I described the problem above, I mistakenly assumed that interrupt vectornumber and interrupt priority vector number were the same, like in theRX600-/RX700-series, but the RX13T shares IPR-settings for TGIA and TGIV withother interrupt vectors of the respective MTU.
The method I described above can be used to have PWM mode 2 on all MTIOC-pinsof MTU0, MTU1 and MTU2, without another MTU for the period setting, as you canuse interrupt TGI0E- or TGI0F-interrupt for that with the following interrupt-code:
MTU.TSTRA.BYTE &=~7;//stop counters MTU0..2MTU0.TCNT=MTU1.TCNT=MTU2.TCNT=0;//clear counters to have initial MTIOC-pin settingMTU.TSTRA.BYTE |= 7;//restart counters MTU0..2
The weekend gave me some time to answer my own question.
sir, iam confused with interrupt of MTU5. I want to blink an led using MTU5 @ 500 milliseconds..(just begining). please send me a blink software using any timer in rx13T. My mcu is R5F513T5ADFL by firstname.lastname@example.org