AnsweredAssumed Answered

L9942 Driver IC SPI Programming

Question asked by Siva Murugesan on Apr 1, 2015
Latest reply on Apr 16, 2015 by Siva Murugesan
Dear Experts,

I am new to L9942 Driver IC.
I am currently working on this IC for a stepper motor control in automotive safety application.


I have attached a 'c' program written for SPI communication with L9942. The controller which I am using is a 8 bit controller. The following are the other details:
       
  • Controller: PIC 16F877A
  •    
  • SPI is used in 8 bit mode (only 8 bit is possible)
  •    
  • Mode 0 of SPI communication is used
  •    
  • Baud rate for communication is 3Mhz (doubtful about this)
  •    
  • The 16 bit register values of L9942 are initialized in two 8bit integer variables
  •    
  • Later these variables (two 8bit variables) are sent one after the other keeping the CSN low consecutively. The same is followed for all 8 registers.
The sequence of the program goes like this for programming all 8 registers.
       
  1. Keep CSN High initially
  2.    
  3. Pull CSN to Low
  4.    
  5. Transfer the first 8bit (MSB first) 
  6.    
  7. Transfer the second 8bit (MSB first)
  8.    
  9. Push CSN to High
The following are not understood:
       
  • Sometimes the output voltage waveform (the output to the motors) is smooth and the motor runs properly, but sometimes there is no response from motor and also at times the waveform is irregular.
  •    
  • At times when the STEP frequency is increased or decreased the motor starts moving. 
  •    
  • Is the SPI communication improper?
  •    
  • Can an 8bit Controller properly communicate with L9942 with 8bit SPI mode?
  •    
  • What should be the baud rate of communication?
  •    
  • I have an understanding that, if once all the 8 register values are loaded, L9942 will take care of driving the motor with a proper STEP input.. is it correct?
  •    
  • I have an understanding that, only the first register has to be reloaded when the direction has to be changed, keeping the program counter bits to 0... is it correct?
  •    
  • There are 8 bits for Stall threshold setting (D0 to D7). As per the datasheet the interval is 16us. So can it only have 2^8=256, therefore 255X16us which = 4080us. So is 4080us the maximum threshold time that can be set?
  •    
  • When does Stall bit set? In my case I am using a Linear actuator. So when it reaches end of position in linear limit, the motor still tries to move but the linear slider does not move. Will this set the stall bit?
Please refer to my attached c program also and help me out.

Regards,
M.Siva

Attachments

Outcomes