2012-10-09 01:45 AM
H
ello
I'm trying to
communicate with SPI
from my application
in
C
with two
L6470
configured
in
daisy chain
mode
.Sending
data but
I get no
response from
the pin DSO of the first
L6470
.Someone
can tell
me
the steps I should
follow to
,for example
,read a record
from both
chips
,I have very clear
as
CS
signal
must act
in
this case
.Thanks
in advance
. #spi-daisychain-l6474-stm32f42012-10-10 12:21 AM
Hello
I've
gotten
the second
L6470
send data
by
SDO
.I'm trying
to
execute the
MOVE
command
and
get
it to move
the engine
for the first
L6470
,but I can not
make it move
the second
.Can anyone
tell me
how I should
do to
send the commands
to the second
L6470
?.Thank you.
2012-10-16 01:33 AM
2012-11-14 08:27 AM
Hello,
I suggest you to check the CS line during the communication.When N devices are connected in chain, the microcontroller must send N bytes at each communication cycle.Your code seems ok, but are you sure the dSPIN_Nop and dSPIN_Write_Byte functions do not change the CS line status? In this case you are able to ''talk'' with the first device, but not with the second one and you are able to ''listen'' the second one, but not the first.Kind RegardsEnrico2012-11-19 07:40 AM
Hello.
Thanks for the reply
.I have checked
that the functions
dsPIN_Nop and dsPIN_Write_Byte
only set to 0 the
CS
line, so use fflush() function to set it to 1
.The writing
in
both engines
working properly
me
, but reading not get it to work.
Regards.2012-11-20 12:57 AM
The result
of reading is
always
0xffff.
2012-11-20 01:02 AM
Sorry,
I changed
the function
of
reading on
which I put
above.
The current
is
: uint32_t dSPIN_Get_Param(uint_8 param, uint_16 niMotor) { uint32_t temp = 0; uint32_t temp2 = 0; uint32_t rx = 0; uint32_t rx2 = 0; uint_16 ncI; /* Send GetParam operation code to dSPIN */ if (niMotor==1) { temp2 = dSPIN_Write_Byte((uint8_t)(0x00)); temp = dSPIN_Write_Byte(dSPIN_GET_PARAM | param); } else { temp2 = dSPIN_Write_Byte(dSPIN_GET_PARAM | param); temp = dSPIN_Write_Byte((uint8_t)(0x00)); } fflush (sDrivers.spifd_6470); /* MSB which should be 0 */ temp = temp << 24; rx |= temp; temp2 = temp2 << 24; rx2 |= temp2; switch (param) { case L6470_ABS_POS: ; case L6470_MARK: ; case L6470_SPEED: if (niMotor==1) { temp2 = dSPIN_Write_Byte((uint8_t)(0x00)); temp = dSPIN_Write_Byte((uint8_t)(0x00)); } else { temp2 = dSPIN_Write_Byte((uint8_t)(0x00)); temp = dSPIN_Write_Byte((uint8_t)(0x00)); } fflush (sDrivers.spifd_6470); temp = temp << 16; rx |= temp; temp2 = temp2 << 16; rx2 |= temp2; case L6470_ACC: ; case L6470_DEC: ; case L6470_MAX_SPEED: ; case L6470_MIN_SPEED: ; case L6470_FS_SPD: ; case L6470_INT_SPD: ; case L6470_CONFIG: ; case L6470_STATUS: if (niMotor==1) { temp2 = dSPIN_Write_Byte((uint8_t)(0x00)); temp = dSPIN_Write_Byte((uint8_t)(0x00)); } else { temp2 = dSPIN_Write_Byte((uint8_t)(0x00)); temp = dSPIN_Write_Byte((uint8_t)(0x00)); } fflush (sDrivers.spifd_6470); temp = temp << 8; rx |= temp; temp2 = temp2 << 8; rx2 |= temp2; default: if (niMotor==1) { temp2 = dSPIN_Write_Byte((uint8_t)(0x00)); temp = dSPIN_Write_Byte((uint8_t)(0x00)); } else { temp2 = dSPIN_Write_Byte((uint8_t)(0x00)); temp = dSPIN_Write_Byte((uint8_t)(0x00)); } fflush (sDrivers.spifd_6470); rx |= temp; rx2 |= temp2; } sDrivers.rx = rx; sDrivers.rx2 = rx2; return rx; }The result
of reading is
always
0xffff.
Thanks.2012-12-05 12:16 AM
Hello,
from my understanding the firmware seems correct. I can only suggest you to check the physical level of the communication in order to verify if there is something wrong in the connections.RegardsEnrico2014-11-13 07:29 AM