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