Monday, January 24, 2011

Using PWM on LPC17xx

PWM can be used for generating analog signals of frequency very much lower than that of the PWM frequency. LPC1768 has one PWM with six channels. There will be one timer for each PWM and this timer will be used by all channels of that PWM. Configuring the PWM is similar to that of configuring a timer. The only difference is that we also need to specify the location of rising and falling edges for each channel that we use.

Follow the steps given below to configure the PWM as you wish.

1. Power up the PWM (LPC17xx manual table 46, pg 63). The PWM will be powered up when the microcontroller resets. So unless you have powered it down, there is need to follow this step.

LPC_SC->PCONP |= 1 << 6;

2. Setup and provide the clock to PWM peripheral (LPC17xx manual table 40 and 42, pg 56 and 57).

LPC_SC->PCLKSEL0 |= 1 << 12; // PWM clock = microcontroller clock i.e the prescaler value is 1.

3. Output pins of the microcontroller must be configured to select the PWM output pins. There is a Pin Control Module in LPC17xx which can be used to select the function of each pin and also it can be used to enable or disable the pull up and pull down registers. (LPC17xx manual table 83 and 91, pg 110 and 114)

LPC_PINCON->PINSEL4 |= 1 << 8; // P2.4 works as PWM1 output.

LPC_PINCON->PINMODE4 |= 1 << 9; // enable neither pull up nor pull down.

4. Set the rising and falling edge configurations as per your requirements.


There are 7 match registers associated with the PWM. By storing suitable values in these registers, desired waveform can be obtained. In this PWM we can control both the rising and falling edges. If we want to control both the edges then we need to use double edged control. Otherwise single edged control is sufficient. If we use double edged control then the number of channels that can be used simultaneously will be reduced, as each channel requires two match registers. In case of single edged PWM, match register MR0 is dedicated for the control of the rising edge of all channels and the remaining six match registers (MR1 to MR6) can be used to control the falling edge of the six channels. Since one of the match registers is required to store the PWM rate (MR0 in case of single edge control) only channels 2, 4 and 6 can be used simultaneously or channels 3 and 5 can be used simultaneously in case of double edge control. Channel one cannot be configured as double edged PWM when MR0 stores the value of PWM rate.

4a. Setting the rate of the PWM.

LPC_PWM1->MR0 = 16; // PWM freq = PWM clock/16

LPC_PWM1->MCR |= 1 << 1; // Reset timer on Match0 (LPC17xx manual table 449, pg 517)

The timer/counter associated with the PWM resets to ONE and not ZERO. Therefore if we need a PWM frequency of (PWM clock/N), then we need to store 'N' in one of the match registers and set the timer to reset on compare with that match register. Usually MR0 is used for this purpose. For single edge control only MR0 must be used to store PWM rate.

4b. For single edge PWM set the position of the falling edge.
In case of single edge control PWM, the PWM output will be high when the timer resets. Therefore we can control only the position of the falling edge. To control the falling edge of channel 'x', store the suitable compare value to MRx register.

LPC_PWM1->MR5 = 8;  // PWM Duty Cycle = 0.5

Here I am storing 8 in MR5. Therefore, now one cycle of PWM waveform consists of 16 PWM clock cycles and for 8 of them the PWM output will be high and for remaining 8 cycles it will be low. Therefore the effective signal produced is a waveform of frequency (PWM clock/16) with a duty cycle of 0.5.

4c. For double edge control (LPC17xx manual table 443, pg 512)
Table 443 of LPC17xx manual shows the match register pairs that are associated with each channel. By loading suitable values to these registers, desired waveform can be obtained. We have already set the PWM rate with the help of MR0 in 4a. Now to configure say, channel 4 we need to use MR3 and MR4.

LPC_PWM1->MR3 = 4;
LPC_PWM1->MR4 = 8;

The PWM output toggles on each compare match. If same value is stored in both the match registers, clear takes precedence and the PWM output will become LOW irrespective of its previous state.

5. Enable the timer/counter and PWM (LPC17xx manual table 447, pg 516)

LPC_PWM1->TCR |= (1 << 0) | (1 << 3);

6. Select control mode for each channel (except channel 1) and enable the PWM output (LPC17xx manual table 451, pg 519)

LPC_PWM1->PCR |= 1 << 4; // Configure channel 4 as double edge controlled PWM

LPC_PWM1->PCR |= 1 << 12; // Enable PWM channel 4 output

LPC_PWM1->PCR |= 1 << 13; //Enable PWM channel 5 output

7. Additional settings
Additional features like interrupt on a match compare or stopping the PWM on a match compare or resetting the PWM timer/counter on a match compare can all be done by playing with the PWM Match Control Resgister (PWM1MCR). Refer table 449, pg 517 of  the LPC17xx manual for further details.

8. Little more about interrupts

NVIC_EnableIRQ(PWM1_IRQn); // This will enable all interrupte pertaining to the PWM1


void PWM1_IRQHandler (void) 
{
}// This is the format in which the interrupt routine must be written

The source of the interrupt i.e to check which match compare caused the interrupt we can check the value of the interrupt flags in the PWM Interrupt Register (PWM1IR). The bit which is HIGH in this register corresponds to the source of that interrupt. The interrupt flag bit must be cleared before exiting the interrupt routine. Otherwise another interrupt will be serviced after completing the current interrupt. To clear the interrupt flag write '1' to that bit. Writing '0' will have no effect.

The complete compiled program that configures channel 4 as double edge control PWM and channel 5 as single edge control PWM and interrupts once in every PWM cycle is here.

I am using this PWM for the generation of sync pulses for TV and the motor control PWM for the generation of audio in the Game Console. More posts on actual Game Console implementation will be coming soon, after I explain every basic thing in LPC17xx that is required for the Game Console.

52 comments:

Thejasvi said...

There was a small problem with the code that was previously uploaded. So I have corrected and uploaded it. The download link in the blog is pointing to the new code now. Please download the new one and discard the previous one.

amit said...

thanx for ur great help sir!, but i have tried the exact code what u have written there in your link bt i dont know why its not showing any output on pwm pin (2.4). code is compiled correctly even interrupt handler is also working properly as i have checked it by controlling a GPIO led pin through this interrupt handler. that means pwm timer is working and also generating an interrupt after matching with match register. bt not showing any output (high/low) in pwm pin. PLEASE HELP !!!!!

Thejasvi said...

Well that is very unlikely. Check it with trying a different PWM pin. Or try making P2.4 as GPIO and check whether the pin is working.

amit said...

i have already tried all pwm pin. all are working in gpio mode also.
while debugging step by step i have noticed as i select any pin as pwm pin by PINSEL 4, the pin turns off and after running all code it never shows any output on any led... :(

Thejasvi said...

Well my code is written to output a square wave of duty cycle 0.5 and a frequency of CLK/16 at P2.4. So effectively the average voltage at this pin should be VDD/2.

What I meant by try different pins is that configure a different channel as single edge PWM, connect its pin to the output port and check whether you get the output. If this is what you did and you are still not getting the output, then I have no idea as to what the problem is.

If you want I can check your code and try to debug it.

Sorry that I am unable to provide a solid solution in this regard.

amit said...
This comment has been removed by the author.
amit said...

sir, i m using keil u vision 3. is dere any possibility of having fault in their source file...??

Neenu said...
This comment has been removed by the author.
Thejasvi .M.V said...

@Neenu
Possible reasons for interrupt not working.
1. Interrupt is not being enabled properly.
What compiler are you using? Are you using the mbed online compiler or Keil or something else? I do not know how you can enable interrupts in the online compiler.
I am using the CMSIS library in the code provided. So you might want to see the equivalent function for mbed online compiler to enable interrupts.

2. mbed compiler by default uses C++. So change the IRQ handler to

extern "C" void PWM1_IRQHandler (void)
{
}

from

void PWM1_IRQHandler (void)
{
}

I think if you take care of these two your problem should be solved. Also I am pretty sure that it is the 2nd reason that is creating your problem.

Do not worry about the PINMODE4. It was just done for an example.

Please do not hesitate to get back with the results if this solution works or does not work.

Neenu said...
This comment has been removed by the author.
Thejasvi .M.V said...

Ok. Try commenting the following line in the code and see if it works

LPC_PINCON->PINMODE4 |= 1 << 9;

If that does not work, please upload your source file (just the main source file) to some google code page and post the link here. I will have a look at it.

Neenu said...
This comment has been removed by the author.
Neenu said...
This comment has been removed by the author.
Thejasvi .M.V said...

@ Neenu

If you check my code, I am doing the following to start the PWM.

LPC_PWM1->PCR |= 1 << 4;
LPC_PWM1->PCR |= 1 << 12; // Enable PWM channel 4 output
LPC_PWM1->PCR |= 1 << 13; //Enable PWM channel 5 output

What you are doing in your code is that, you are just starting the timer but you are not enabling the starting the PWM. As the timer is running, you will get an interrupt once every complete timer cycle. So adding these three lines after starting the timer should get you the output on the PWM pins.

dinesh kumar. R said...

Hi,

Sorry to ask this. this is about SPI, pls suggest me if you have any idea.

I am using LPC1768 micro controller for SPI interface to configure HOLTEK Analog signal processor (HT82V36). Actually that is 3 wire SPI interface in HOLTEK. so i shorted MISO, MOSI with 10k resistor as mentioned in one website.

In this, should i send address first (7 bit) and data (9 bit) or else 16 bit (address and data) at one shot. the register address in HOLTEK slave is 3 bit and 1 bit for (R/W). and what about remaining 3 bits in the address byte ( 7 bit).

how to send a 7 bit address byte in a 8 bit configured spi in mcu.

what is the actual protocol to be followed?

thanks & regards,
Dinesh.

Thejasvi said...

If you ignore the chip select line, then SPI becomes a 3 wire interface with just SCK, MISO and MOSI. Just connect 3 wires to the corresponding pins from LPC1768 to the HOLTEK processor.

Regarding the protocol that you should follow to setup the HOLTEK processor, please refer its datasheet. I bet that you will find all the information there.

dinesh kumar .R said...

Actually, HOLTEK datasheet mentioned to short MISO & MOSI as a data line. no problem with the pinouts.

The problem is that the protocol.

address - 3 bits.
R/W bit - 1 bit.

this is the complete address byte we have to send. but, SPI data transfer configured as 9 bit per transfer why because data which we are going to send or receive is 9 bit.

should we send remaining 5 bit in the address byte as dummy one? that is not given in the data sheet.

MCU - LPC1768
holtek - ht82v36.

pls kindly check the datasheet once. here s the link.

http://www.holtek.com.tw/pdf/computer/82v36v140.pdf

Thejasvi said...

In this case you will have to connect the SDATA of HOLTEK directly to MISO of LPC and SDATA of HOLTEK to MOSI of LPC via a 10k resistor.

Regarding the address and data, you will need to first send 1-bit indicating read/write, then 3-bits of address, then 3-bits of 0s and then 9-bits of data. So, you will need to transfer a total of 16-bits. Divide this 16-bits into two 8-bit transations.

So while writing the data, first write 8-bits where the MSB is r/w bit, next 3 MSBs are the actual address bits, next 3 MSBs are 0s and the LSB is actually the MSB of the data and the consequent 8-bit data will actually be the 8 LSB bits of the data.

When receiving data, write 8-bits where the MSB is r/w bit, next 3 MSBs are the actual address bits and remaining 4-bits are 0s. During this time read the LSB of what you received in MISO - This will be the MSB of the 9-bit data. Then send a dummy 8-bit data to receive next 8-bits of data in MISO.

dinesh kumar.R said...

hi thejasvi,

In lpc17xx, they had given two PWM1[1-6], in port 1 and also in Port 2.

but, when i tried with PWM in port 1, it is not working and getting output in PWM in port 2. how to make use of PWM in port1. is there any register settings to be changed??

Thanks & regards,
Dinesh.

Thejasvi said...

Make sure that you are configuring the PINSEL registers correctly. For port2 PWM pins are used for setting "01" in PINSEL registers. But for port1 PWM pins you will need to set it as "10".

If you have configured it correctly, but still it is not working with port1, configure port1 as GPIO and check if you can just toggle the pins (something like blink an LED). If you cannot toggle the pins in the GPIO mode, then you might have damaged them sometime.

dinesh kumar.R said...

hi @thejasvi,

I tried with GPIO toggling, it is working fine. but, still i am getting two PWM output (channel 1 & channel 3). still i am not getting any response in other PWM channels of Port 1.

Thanks & regards,
dinesh.

Thejasvi said...

That is weird. I have nothing but asking you to check your initialization code for the remaining channels.

1. Make sure the PWM is enabled
2. Single edge or double edge is configured
3. Particular channel of the PWM is enabled
4. Match registers are set properly
5. Correct functions for correct output pins are selected

dinesh kumar.R said...

hi @thejasvi,

Thanks for your response and time. that was the problem in the board i am using (embest EM-LPC1700).

those PWM pins which are not working is connected to the joystick. i removed joystick. now its working :)

Thanks & regards,
Dinesh.

dinesh kumar.R said...

Hi @thejasvi,

I am currently working on SSP interface. I have two LPC1768 boards. I configured 1 as master and another as slave. i will pump the byte_data from master for every external interrupt and slave will collect the data once it recognize tat data has been arrived through status registers of the slave.

But now, in the keil debugger, i am checking the data register of SSP. the SSP1DR (data register) is not updating with data what i am sending rather it is updated by 0xFF. and the same 0xFF is received in the slave side.

Is this clock issue or hardware problem??

Thanks & regsrds,
Dinesh.

Thejasvi said...

Do you mean to say that 0xFF is being written to the SSP data register even on the master side, even when you write something else?

However, if the master is sending correct data out of its data register and the slave is receiving 0xFFs, I would say that there is some connection problem with the MOSI line.

dinesh kumar. R said...

yes, you are right.

when i tried to write data register from master side (i.e.) whatever data, it is updated with 0xFF. I checked the SPI_clock, it is generated and i am able to toggle all the SPI_pins (no hardware issue). i don't know how to debug this issue.

Thanks & regards,
Dinesh.

Thejasvi said...

I just checked the data sheet, and basically in LPC17xx whatever you read from SSP data register is what it has received from MISO pin.

I would recommend you to check the SPI signals using an oscilloscope, check the SCK, MOSI, MISO and CS_n pins when you send something from the master.

If you can see a clock on SCK and the correct data what you are sending on the MOSI pin, then it means that SPI is configured correctly on the master side. Also note the data shifted out on the MISO pin. I guess in your case, the slave itself is sending 0xFFs and that is why you are receiving it.

dinesh kumar.R said...

i checked the signals in oscilloscope, i am getting SCK but nothing in the MOSI.

when i am executing this instruction for writing data register. at that time itself it is updated with 0xFF.

--> SSP0->DR = 0x41;

if it is sent by slave means, the data register should be updated by 0xFF once this instruction is executed.

-> while(!(SSP0->SR & 0x00000011));

I dono how to debug and more importantly i am not getting any signals in MOSI.


Thanks & regards,
Dinesh.

Thejasvi said...

Just curious, using a debugger you can see what is in the DR register either before executing an instruction or after executing an instruction. But how can you say that DR is being written with 0xFF when you are executing an instruction?

If you do not see any activity on MOSI, then it might also mean that the master is sending either all 0s or all 1s. Are you seeing all 1s on the MISO line? If that is the case, then it explains the 0xFFs. Can you disconnect the MISO line from the slave and connect it to ground and then see if the DR register is being written with 0 after the SPI transaction is complete?

dinesh kumar.R said...

It was the clock configuration issue and it is resolved.

Now, everything seems to be okay. I am able to send data from master and verified
through oscilloscope. but i am unable to process data from slave side (i.e.) i cant save the received data to the variable. eventhough if i do, it is showing either 0x00 or 0xFF and not showing exact data in the slave data register. is there any possiblities to debug this issue??

Thanks & regards,
Dinesh.

Thejasvi said...

If you are having problems with SPI data correctness, then I would recommend you to reduce the SCLK frequency to a low value (something in mere 1 or 2kHz) and check whether everything is working fine. Sometimes the slaves cannot handle high frequencies and that will be the cause of data corruption.

You could always check what is happening on the SCLK, MOSI and MISO lines of the SPI. If everything seems fine in the SCLK and MOSI lines but the slave is receiving some nonsense, then it is most probably a SCLK frequency problem with the slave.

You could also use a debugger on the slave side (if your slave is also a microcontroller or it has a debugger) and see the contents of the DR register. I guess in your case the DR register contents on the slave will itself be not what the master sent.

dinesh kumar.R said...

@thejasvi,

I am already checking the slave by connecting the debugger on the slave side only. and yes, it is not showing the exact data in the DR of the slave which i sent from master instead showing '0xFF'.

i have a doubt, the clock for the slave is driven from the master only right? in that case, PCLK - 100Mhz in both master and slave. SPI_clock of master - 400KHz. is there any other register to be set in the slave side like SCR. clock configuration in the slave side is not relevant since master is driving the clock. am i right?

thanks & regards,
Dinesh.

Thejasvi said...

Yes, the clock from the master drives the slave. So no need to set SCR register.

Did you see correct data being sent on MOSI when you use an oscilloscope?

dinesh kumar.R said...

@thejasvi, when i send data from the slave i am able to see the data in the oscilloscope and also the clock.

but unable to receive in the slave side (i.e.) cant able to process the data or see the data in the data register.

thanks & regards,
Dinesh.

Thejasvi said...

Let me summarize what all I have understood regarding your situation.

1. You are configuring the SPI modules on both the master and the slave side correctly. That is you are powering up the modules, providing clock for them, configured the registers in both modules for the same CPOL CPHA and everything else.

2. You see the SCLK fine on the oscilloscope

3. You see the data you are sending from the master on the MOSI line (with the oscilloscope)

4. You see the data you are sending form the slave on the MISO line (with the oscilloscope)

5. The CSbar line is asserted correctly when this transaction is happening (checked with oscilloscope?)

Even with all this, you are getting 0xFF in the DR register of the slave.

If all the 5 points that I listed above are true in your case, then I have no idea what is wrong with it. If any of the points is not true please clearly state which is not true.

dinesh kumar.R said...

hi @thejasvi,

I am okay with the first three points. but i am not receiving any data in the MISO pin of the master and i have to check with the CS pin.

So, your point is that the slave is not driven low while sending data. right?

I have not checked with oscilloscope but in slave program, it is overcoming the while loop which is waiting for the RNE bit in status register (i.e.)slave receiving data. right?

if the problem is with CS, the data will not be received nah.


thanks & regards,
Dinesh.

Thejasvi said...

Then I guess the slave is not properly configured or in worst case the slave module has gone bad (which is highly unlikely)

Instead of waiting in a while loop for the RNE bit, can you read the entire status register and print its value? Why I am asking this is because, if the slave SPI module has gone bad, then there are chances of it sending something lik 0xff when you read the status register.

Another easy way to test this is by removing the SCLK connection. Then if everything is correct with the slave module, your code should get stuck in the while loop.

Also check the CSbar signal.

hrz said...

hi thejasvi

i'm using LandTiger LPC1768 board to drive a servo by using PWM signal..I have configured the PWM to work on 50Hz to drive the servo

I have successfully control the PWM by using on-board potentiometer, which is verified by channeling the PWM signal to the on-board LED (brightness changed). I have also verified that the PWM is working by checking the PWM output pin (P2.0) signal by using oscilloscope & I'm getting some signal..

however, when I'm trying to drive the servo by channeling the PWM from pin P2.0 to the PWM input of the servo, the servo doesnt move at all. I'm using 6v battery supply for the servo.. Is there anything I missed? is this because the PWM signal is too weak to drive the servo?

thx in advance

Thejasvi said...

I do not know what servo driver you are using. But I think it might be a voltage level issue. I guess your LPC1768 board uses a 3.3V VCCIO i.e. all the high outputs are at 3.3V. Please check whether the servo driver you are using accepts this voltage level as high.

The servo driver should not draw much current on the PWM input lines (as these are internally connected to the gates of MOSFETs) and thus I do not think that the PWM ouput of the LPC1768 is getting loaded. If you still have a doubt on this, check whether you are getting the PWM signal, using an oscilloscope, when connected to the servo driver.

hrz said...

Hi Thejasvi thx for your reply

I think you are right about the voltage, because last time I checked the PWM on the osciloscope I had to use the 10x magnification.I was unsure. I'll check on your suggestion again later..

but in case if your're right, does that mean that i had to use some kind of interfacing circuitry/board to amplify the pwm before sourcing it to my servo?

thx

Thejasvi said...

If there is a voltage level/logic level mismatch between the LPC1768 and the servo driver, then the easiest thing to do is to find a servo driver that works this logic output. Else you will need to boost all the PWM signals to appropriate levels before giving it to the servo driver (which will make things difficult and increase circuitry)

hrz said...

Hi Thejasvi

I have checked that the servo accepts 3.3v voltage.. and that the PWM signal still there while I connects the PWM output to the servo

I have rechecked the PWM on oscilloscope and had realized that my period & duty cycle setting are actually the cause of the problem.

How do I obtain 50Hz PWM from the board? I had been confused with the clock & prescaling part..

here's some of my settings;

LPC_SC->PCLKSEL0 |= 1 << 12; --> this means that PWM clock is = CCLK = 100MHz ?

how do I prescale so that i got 1Mhz on the clock part so that I could use:
LPC_PWM1->MR0 = 20000;
LPC_PWM1->MR1 = 1500;

to obtain 1.5ms pulse width with 20ms period of PWM signal

pardon me but this is my first time working with PWM and servo so really appriciate ur help. thx

Thejasvi said...

Prescaler is just a division factor for the PWM input clock and the system clock frequency. So if you have 100MHz system clock, you can probably divide it by 2,4,8 and so on and feed this prescaled clock to the PWM. So you cannot obtain all values of frequencies from a prescaler for a given input frequency.

It is easier to change the MR0 and MR1 values based on the PWM input frequency, instead of trying to adjust the PWM input frequency while keeping MR values constant.

sebastian said...

thanks for a good tutorial....

i tried same program.....but i m not getting double edge output...its just acting as a single edge control pwm and its falling edge depending only on match register 3(MR3)!!!!!......please help...

Thejasvi said...

@ sebastian

I did not face any problems like this. So I would recommend you to please check that the channel 4 is configured as double edge PWM.

sebastian said...

ok...I made a mistake....
I am using LPC 1768 board....I wrote a program for creating interrupt when counter matches with match 0 register.....but its mot entering into interrupt program....led3 is not toggling...will you please tell the mistake...attached c prog
#include "mbed.h"

void PWMInit();

PwmOut chA(p23);
DigitalOut chB(LED3);

int main (void)
{
PWMInit();

while(1) {


LPC_PWM1->MR3 = 6000;
LPC_PWM1->MR4 = 15000;
LPC_PWM1->LER |= (1<<3) | (1<<4) ;




}

}


void PWM1_IRQHandler (void)
{
if((LPC_PWM1->IR & 0x01) == 0x01) // Check whether it is an interrupt from match 0
{

chB != chB;
wait(.2);

LPC_PWM1->IR |= 1<<0; // Clear the interrupt flag
}



return;
}

void PWMInit()
{
LPC_SC->PCONP |= 1 << 6; // enable power for PWM1
LPC_SC->PCLKSEL0 |= 1 << 12; // PCLK_PWM1 = CCLK

LPC_PWM1->MR0 = 16000; // PWM freq = CCLK/16000

LPC_PWM1->MCR |= 1 << 0; // interrupt on Match0

LPC_PINCON->PINSEL3 |= (2 << 14 ); // P2.4 works as PWM1 output
LPC_PINCON->PINMODE3 |= 2 << 14; // enable neither pull up nor pull down


LPC_PWM1->PCR |= 1 << 4; // Configure channel 4 as double edge controlled PWM
LPC_PWM1->PCR |= 1 << 12; // Enable PWM channel 4 output

LPC_PWM1->MR0 = 16000; // PWM freq = CCLK/16000

LPC_PWM1->TCR = (1 << 0) | (1 << 3); // enable timer counter and PWM



NVIC_EnableIRQ(PWM1_IRQn);
return;
}

Thejasvi said...

First of all PwmOut() API of mbed takes care of the pin mode selection and configuration, so no need to set the PINSEL and PINMODE registers again.

Second, I do not see any code that sets a match register for timer reset. I guess your intention was to use MR0 to reset the timer. In that case you will need to set bit 1 of MCR (See step 4a of the tutorial).

LPC_PWM1->LER |= (1<<3) | (1<<4) ;
Here what is the LER register?

And no need to set MR3 and MR4 in a while loop.

But still these things wont explain your interrupt problem. I have forgotten some of the details of LPC17xx, but if the timer resets on the same clock as it matches with MR0, i.e. if the timer never reaches MR0 value, then you will not get an interrupt. So try using some other match register for generating the interrupt. But if the timer resets in the next clock cycle after the match, then you should get an interrupt.

Let me know whether it works or not.

dinesh kumar.R said...

lpc1768 ISP using usb-serial converter
Hi @all,
I have embest LPC1768 board and i tried ISP through RS232 cable and it is working fine. How to do ISP through usb-serial converter? I installed the driver and it is ok. but when i opened the FLASH MAGIC tool to flash, the device is not detected (i.e) read device signature showing error (auto baud rate error). and even in my laptop, it is not working with RS232 port. i don't have any clue why this not functioning.

why it is showing this error and how to do ISP through usb-serial converter?

Thejasvi said...

@dinesh

Have you checked the standalone working of the usb-serial converter? If not, you can just short the RX and TX pins on the serial side of the converter and do an echo test using tera term or hyperterm.

Anonymous said...

hello,i am sudeep i have a doubt on the pwm using the lpc1769 . i want to generate the 2 different frequencies with variable duty cycle
using the PWM how can i do that.

whether for double or single edge controlled the MR0 has to be loaded with values if so it is not possible to produce the 2 different frequencies na

HARSHA said...

Hello Thejasvi,

I am from Pune India. Thanks a lot for providing proper explanation on PWM of 1768. Just I want to know, if these are the basic PWM channels, then why LPC1768 has provided additional PWM Motor Controller Functionality as separate?

Thore Trompf said...

Hi,
is the code still available. The link dosn't work.