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.

LM8330: Customer got LM8330 PWM issue

Part Number: LM8330

Dear Team:

 Our customer use LM8330, but got PWM issue as below/

Could you help the case?

Hi Thomas,

 

We have face some PWM problems. After we give the enable, on and dutycycle commands to LM8330, PWM will be pull high to 1.8v but it always stays at 1.8v. When we give other dutycycle commands to LM8330, PWM still stays at 1.8v.

It seems like the enable and on commands are work but the dutycycle command cannot control the PWM signal.

Are there any wrong steps in our command orders or there are some values and settings that we miss it?

  • Hi Thomas,

    We can check into this. Can you please let us know the register configuration/command sequence that is being used to set up the PWM signal? Then we can see if any modifications are needed.

    Thanks,
    Max
  • Hey Thomas,

    Can you tell us what the customer is writing to these bits in registers 0x61, 0x69, and 0x71?:

    Can you also confirm that the customer is using the correct GPIOs(16-19)?

    -Bobby

  • Hi Bobby
    I am Wistron EE and check this quest with Thomos.
    For register 0x61, 0x69, and 0x71 we all check for these registers, and these are all correct.
    And for GPIO16-16 are also correct, too.
    Any other suggestions that we can try more?

    Thanks
    Kent
  • Hey Kent,

    Can you provide us with what registers and data you are sending the device? It may help us to understand why we aren't able to toggle the PWM correctly.

    Thanks,

    -Bobby

  • Hi Bobby,

    Registers and data that we sending to the device are showed below.

    The following table shows the process of data sending from the begining to working pwm.

    Register Data
    0x81 84 (default: 84)
    0x84 00 (default: None)
    0x8B 00 (default: 00)
    0x03 00 (default: 22)
    0x88 00 (default: 00)
    0xA7 11 (default: None)
    0x8A 04 (default: 00)
    0x7D 27 (default: 00)
    0x7C 12(default: None)
    0x68 00 (default: 00)
    0x69 06 (default: 00)
    0x7A 02 (default: 00)
    0x7B 02 (default: 00)
    0x88 01 (default: 00)
    0x91 04 (default: 00)

    Also we find out that the default value of register 0xD1 and 0x91 must be ff and 80 but they shows 0f and 00 in our device.

    Are there any register that we miss to send data to it?

    Thanks,

    Arthur

  • Hi Bobby

    update the table due to some error occur for Arthur:

    Register

    Data

    0x81

    84(default:00)

    0x84

    01(default:00)

    0x8B

    00(default:00)

    0x03

    00(default:00)

    0x88

    01(default:00)

    0xA7

    11(default:None)

    0x8A

    04(default:00)

    0x7D

    27(default:00)

    0x7C

    12(default:00)

    0x68

    00(default:00)

    0x69

    06(default:00)

    0x7A

    02(default:00)

    0x7B

    02(default:00)

    0x88

    01(default:00)

    0x91

    04(default:00)

    Please have your comment on it.

    Thanks

    Kent

  • Hi Bobby

    Registers and data that we sending to the device are showed below.

    The following table shows the process of sending data from the beginning to working pwm.

    Also we find out that the default data of register 0xD1 and 0x91 must be ff and 80 but it shows 0f and 00.

     

    Register

    Data

    0x81

    84(default:84)

    0x84

    01(default:None)

    0x8B

    00(default:00)

    0x03

    00(default:22)

    0x88

    01(default:00)

    0xA7

    11(default:None)

    0x8A

    04(default:00)

    0x7D

    27(default:00)

    0x7C

    12(default:None)

    0x68

    00(default:00)

    0x69

    06(default:00)

    0x7A

    02(default:00)

    0x7B

    02(default:00)

    0x88

    01(default:00)

    0x91

    04(default:00)

                                                                                                                                                                                    

    Are there any register that we miss to send?

     

    Thanks,

    Arthur

  • Hello Arthur,

    I apologize for the delayed response. This device is actually unique compared to our other I2C devices because it uses a command script buffer. I am unfamiliar with this kind of design so I had to reach out to the previous engineer who supported this device to try to understand how it works. I believe I figured it out and think I may know why you aren't seeing the output you want.

    From the information you have provided, I do not see you writing to the PWMCFG register (0x7E). I also believe you are incorrectly writing to the PWMWP register (0x7D). These two registers need to be used together to write to the PWM ports to generate a duty cycle. (I believe the internal PWMCFG are preset to 0x00 which means they repeat the start script....)

    I think it would be easier to walk through an example of how to do this properly.

    The example I will do is to set PWM1 port to a 25% duty cycle.

    We first need to adjust the pointer of the configuration register to point to the first address for the PWM1 script buffer. This script buffer pointer for PWM1 starts at 32(decimal) and ends at 63(decimal).

    1) Register (0x7D) --> Data (0x20h or 32 decimal)

    We next need to write to the SET_PWM_command in this script to generate our desired duty cycle. Please not the configuration register is actually a word of two bytes in length unlike most of the other registers. The command to set a 25% duty cycle is controlled by bits 0-7 where 0x00h is 0% and 0xFF is 100%. This gives us a resolution of 8 bits. 8 bits of resolution gives us 256. So to calculate the 25% we need to calculate what to set the duty cycle bits to: (25%/100%)*256=64 (decimal) to achieve a 25% duty cycle. The upper byte needs to be set to 0x40h to let the configuration register know the command we want to use is the "set pwm command." The lower byte we input needs to be 64(decimal) or 0x40 to set the desired duty cycle.

    2) Register (0x7E)-->Data1(0x40h)->Data2(0x40h)

    Note at this point: because we wrote two bytes into the configuration register, the PWMWP pointer has now moved to 0x21h or 33 decimal

    I suspect the data in this register (where the pointer points which is now 0x21h) will be 0x00h so this will implement the "go to start" command which will jump to the first command in the PWM1 script.

    At this point we have successfully set the PWM to a 25% duty cycle for PWM1.

    If we want to set PWM0 to do the same thing, we would repeat this process but make the pointer for PWMWP point to 0x00h instead of 0x20h.

    Let me know if this works for you,

    -Bobby

  • Hi Bobby,

    I have a question. I see there is a Branch Command in PWM Script command.

    How do I get the value of loopcount and stepnumber? Is there any function to calculate or I just give the value as I like that is defined in the spec?

    Thanks,

    Arthur

  • Hey Arthur,

    The loop count is 6 bits so if you wanted to loop 0 times you would write bits 7 though 12 to be 0 and if you wanted to loop 63 times then you would set bits 7 through 12 to be 1s. if you wanted 33 for example you would do 100001.

    Step number in this case does NOT refer to how large you increment a counter each iteration. Step number is related to the address (how you address) if you set bit 6 to a zero then you will use absolute addressing mode and will jump to the address you specified. If you set bit 6 to 1 then you are now using relative addressing and will move the pointer (for the script buffer) backwards to the amount you specified. Step number in this case does NOT refer to how large you increment a counter each iteration.

    Thanks,
    -Bobby
  • Hi Bobby,

    Why does the clock mode change to sleep mode while I set the different dutycycle in the pwm1?

    Thanks,

    Arthur 

  • Arthur,

    Can you walk me through how you are writing the script buffer for PWM1? (Register and data)

    The clock mode should not be affected when you write to the PWM1 buffer script.

    Are you accidentally writing to 0x8B? If you read this address, what is bit 0?

    Thanks,
    -Bobby
  • Hi Bobby,

    I didn't write any value into 0x8B.

    The device work fine after I write the script buffer for PWM1 at the first time.

    This error happens while I write the script buffer for PWM1 at the second time.

    At first time(dutycycle = 255(100%))

    0x7D 0x20

    0x7E 0x00 0x00 (GO_TO_START Command)

    0x7D 0x22

    0x7E 0x01 0x03 (Ramp Command)

    0x7D 0x24

    0x7E 0x40 0xff (Set PWM Command)

    0x7D 0x28

    0x7E 0xA0 0x00 (Loop Command)

    0x7D 0x30

    0x7E 0xD8 0x00 (End Command)

    0x7C 0x7E

    0x68  0x00

    0x69  0x06 

    while it finish write 0x06 into 0x69, 0x7A, 0x7B read back is 0x02, 0x02. Bit 0 of 0x8B still shows 0 and Bit 0 of 0x88 shows 1.

    At second time(dutycycle = 127(50%))

    0x7D 0x20

    0x7E 0x00 0x00 (GO_TO_START Command)

    0x7D 0x22

    0x7E 0x01 0x82 (Ramp Command)

    0x7D 0x24

    0x7E 0x40 0x7f (Set PWM Command)

    0x7D 0x26

    0x7E 0xA0 0x00 (Loop Command)

    0x7D 0x28

    0x7E 0xD8 0x00 (End Command)

    0x7C 0x7E

    0x68  0x00

    0x69  0x06

    while it finish write 0x06 into 0x69, 0x7A, 0x7B read back is 0x10, 0x10, Bit 0 of 0x8B still shows 0 but Bit 0 of 0x88 still shows 0.

    And 0x69 read back is 0x00 not 0x06, it seems like that 0x69 can not be written in the second time.

    Thanks,

    Arthur

  • Hi Bobby,

    Also there is an other problem. In spec, 0x88 is able to read and write. But I try to write value into 0x88, it can not work.

    Thanks,
    Arthur
  • Hi Bobby,


    Could you tell us what is the right steps to write the script commands? In other words, which script command should be written first then second, third....... and which one is the last? 

    Do we miss any register that should be written?

    Thanks,
    Arthur

  • Hi Bobby,

    Please reply us immediately if you have any answers.

    Thanks,
    Arthur
  • Hi Bobby,

    There is another problem. The PWM doesn't have any wave form that the pwm must have, the wave form just obtain pull high while we write 255(100%) dutycycle at the first time.

    Thanks,

    Arthur

  • Hey Arthur,

    I just took a look at the values you wrote to the script buffer the first time.

    I've attached some of my comments here:         

    LM8330 customers script buffer.txt
    At first time(dutycycle = 255(100%))
    
    0x7D 0x20				//adjusts pointer to first line of PWM1 scripter buffer i will denote as PWM1script(0)
    
    0x7E 0x00 0x00 (GO_TO_START Command)	//jumps to itself? (May actually just jump to first do-able command but I am unsure)
    
    					//pointer is now pointing to PWM1script(1) due to auto increment which has go-to-start command so I assume this actually makes the code jump back to PWM1script(0) 
    
    0x7D 0x22				//adjusts to pointer to PWM1script(3)
    		
    0x7E 0x01 0x03 (Ramp Command)		//step once, increment 3
    					//address is now PWM1script(4)
    0x7D 0x24				//points to PWM1script(5)
    
    0x7E 0x40 0xff (Set PWM Command)	//sets duty cycle to 100% 
    					//pointer now points to PWM1script(6) which has go-to-start command as default
    0x7D 0x28				//points to PWM1script(9)
    
    0x7E 0xA0 0x00 (Loop Command)		//loops continuously 
    					//pointer now points to PWM1script(10) which has go-to-start command as default
    0x7D 0x30				//moves pointer to PWM1script(18)
    					
    0x7E 0xD8 0x00 (End Command)		//stops script
    
    0x7C 0x7E				//clear interrupts
    
    0x68  0x00				//enables interrupts 
    
    0x69  0x06 				//begins the script 
    
    while it finish write 0x06 into 0x69, 0x7A, 0x7B read back is 0x02, 0x02 //This should signify the program has finished 
    
    Bit 0 of 0x8B still shows 0 and Bit 0 of 0x88 shows 1.			//sleep mode disabled and device is in operation mode
    ------------------------------------------------------------------------------------------------------------
    
    At second time(dutycycle = 127(50%))
    
    0x7D 0x20
    
    0x7E 0x00 0x00 (GO_TO_START Command)
    
    0x7D 0x22
    
    0x7E 0x01 0x82 (Ramp Command)
    
    0x7D 0x24
    
    0x7E 0x40 0x7f (Set PWM Command)
    
    0x7D 0x26
    
    0x7E 0xA0 0x00 (Loop Command)
    
    0x7D 0x28
    
    0x7E 0xD8 0x00 (End Command)
    
    0x7C 0x7E
    
    0x68  0x00
    
    0x69  0x06

    "The PWM doesn't have any wave form that the pwm must have, the wave form just obtain pull high while we write 255(100%) dutycycle at the first time."

    Also, please note that a 100% duty cycle is just a high signal. (it will not turn on and off but just stays on)

    From what I can see, it looks like you may be writing to the script improperly. I will provide an example of what a 50% duty cycle into a 0% to a 100% program should look like.

    Here is an example:        

    LM8330 customers script buffer bobbys revision1.txt
    At first time(dutycycle = 255(100%))
    
    0x7D 0x20				//adjusts pointer to first line of PWM1 scripter buffer i will denote as PWM1script(0)
    
    0x7E 0x40 0x7f (Set PWM Command)	//sets duty cycle to 50%; PWM1script moves to PWM1script(1) or register 0x7D has data of 0x21 now
    
    //we no longer need to set the register and can just send data because every two bytes written will auto increment the PWM1script address by 1
    					
    0xBF 0xC1 (Loop Command)		//loop command: loops 63 times, uses relative addressing which moves the PWM1script pointer back 1 address (will point to PWM1script(0) in this case)
    					//basically loops set PWM command 63 times so we can think of this as a wait or delay command
    
    0x40 0x00 (Set PWM Command)		//sets duty cycle to 0% or off;
    
    0xBF 0xC1 (Loop Command)		//same as before, we will hold the LED off for 63 loops
    
    0x40 0xFF (Set PWM Command)		//we will turn the LED on for 100% duty cycle or keep it on 
    
    0xBF 0xC1 (Loop Command)		//same as before, we will hold the LED ON for 63 loops
    
    0x00 0x00 (go to start command)		//we will now jump back to PWM1script(0) or first line of the program, note we will loop 50% to 0% to 100% forever with this code.
    
    					
    0x7C 0x7E				//clear interrupts
    
    0x68  0x00				//enables interrupts 
    
    0x69  0x06 				//begins the script 
    
    
    
    

    From what you have provided, I do not see any reason why the device should be entering sleep mode....

    Let's first try to get the PWM script to work.

    Let me know if the example I provided works/helps.

    Thanks,

    -Bobby

  • Hi Bobby,

    Your example is helpful but I have a question.

    Our input voltage is 1.8v but I follow your example, the voltage is only 1.2v.

    Also I try a test that only set the command as below, the voltage is only 0.4v.

    0x7D 0x20

    0x7E 0x40 0x7f

    0x00 0x00

    0x7C 0x7E    

    0x68  0x00    

    0x69  0x06     

    Then I try the above command again but only change dutycycle to 255, th voltage is from 0.4v up to 1.8v.

    Can you help us to figure out this problem?

    Thanks,

    Arthur

  • Hey Arthur,

    "Our input voltage is 1.8v but I follow your example, the voltage is only 1.2v."

    1. Are you saying the input voltage is changing or the output voltage on PWM1 out is 1.2V?

    2. How are you measuring this voltage change? (Digital multi-meter or o-scope?)

    3. Can you provide o-scope shots of the PWM1 output?

    4. Are you using the internal pull up resistor or do you have an external one? (is there a schematic you can show us of the LM8330 device?)

    "Then I try the above command again but only change dutycycle to 255, th voltage is from 0.4v up to 1.8v."

    -This makes sense. a duty cycle of 255 bits set is equal to 100% or always on so the output voltage should be equal to Vcc.

    Thanks,

    -Bobby