Hi all,

i meet a problem to control the driver L9935 to control a stepper motor, can you help me please ?

Describe of the problem:

On my board there is a PIC18F4550.
I use the Microchip USB framework to make communication PC-PIC18. I send a request from the PC to the PIC for pilot the stepper motor.

The L9935 is a driver controlled by a BUS SPI. I have configured it correctly (I think):

TRISAbits.TRISA5=0; // /EN output
TRISBbits.TRISB0=1; // MISO input
TRISBbits.TRISB1=0; // SCK output
TRISCbits.TRISC7=0; // MOSI output


TRISD=0x00; // PORT D output (chip select CS1, CS2)

i use the SPI.h librairy:

OpenSPI(SPI_FOSC_64, MODE_00, SMPEND); //SPI Master mode, clock = Fosc/64 (20MHz/64)
//MODE_00 Setting for SPI bus Mode 0,0
//SMPEND Input data sample at end of data out
//SMPMID Input data sample at the middle of data out

In my soft i send a first message to active the driver SDO=0xFF, after when the request arrive the soft send the correct sequence to the driver :

/*************
SDO=0x1B
SDO=0x13
SDO=0x12
SDO=0x1A
***************/

I respect Ten_SCK and the propagation time... I control correctly the falling slope and rising slope of /EN and CS

I take an example of message:

Click image for larger version. 

Name:	mesure1.jpg 
Views:	11 
Size:	25.3 KB 
ID:	71783

Ten_SCK(exp)=38µs

I have mesured the signals, I haven't found problem, the messages are correctly send from the PIC but the L9935 always return 0xFF ...

The motor is never powered .

I don't understand the lines below of the technical documentation:

5.2.2 Turning on
Changing bit 5 or bit 4 or both to LOW will turn on either M11 and M22 or M21 and M12
(depending on the phase signal bit 3). Current will start to flow through the load. The current
will be sensed by the drop across R1.
The threshold of the comparator comp 1 depends on the current settings of bit 5 and bit 4.
The current will rise until it exceeds the turn off threshold of comp 1.

I have test to send 0x0F and 0x1F at the begin of my soft but no change.

I have controlled electricals connections and ground problem, it's ok.


I am blocked ... can you help me?
Sorry for my english it is very bad ... If you want more details i can send them





Thanks for your help!