I'm working on an application that talks to to 4 different peripheral chips using a shared SPI bus. I have configured a SPIMaster_LDD component for this. In the process of troubleshooting some strange behavior I found what looks like an error in the PE generated code. In SelectConfiguration the chip select bit is setup with the following line of code:
((STEP_SPI_TDeviceDataPtr)DeviceDataPtr)->TxCommand = 0x80010000U | CSToMask[ChipSelect]; /* Prepare command for transmision */
The problem with this is that the PCS0 bit is always getting set, resulting in more than one CS signal being asserted. If I manually change the line to
((STEP_SPI_TDeviceDataPtr)DeviceDataPtr)->TxCommand = 0x80000000U | CSToMask[ChipSelect]; /* Prepare command for transmision */
everything works as expected.
I've looked through the component options and don't see anyway to turn this off. If I change the "Initial chip select" option, then the mask changes, but I haven't found a way to set it to zero.
Am I missing something, or is this a bug?
Thanks,
~Dave
Cpu: MK20DX256VLQ10
- CodeWarrior for MCU
Version: 10.3
Build Id:121211
Hi Dave,
yes, this is a bug in the SPIMaster_LDD component. Thank you for reporting it. The fix is available in CodeWarrior V10.4.
Best regards,
Ladislav Vadkerti
Freescale, Processor Expert team
Hi Ladislav,
I have added SPIMASTER_LDD component to processorExpert.pe in bsp_twrk60n512.
I have set the configuration and generated the code also, can you please guide how to replace
the existing spi driver in MQX 4.0.0 and use the new generated SPI driver? Am using CW10.3
Intention is to use PE LDD driver instead of the existing SPI driver.
Thanks,
GR.Venkatesh