- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have two PSoC4 L-Series Pioneer Kits (CY8CKIT-046) that I need to make talking to each other on a SPI bus. I found good sample code CE224339_PSoC4_SPI_Master_Polling01
and
CE224463_PSoC4_SPI_Slave_Polling01
that seem pretty simple and actually work. (They are located in the samples/SPI_polling folder in the workspace bundle that is attached to this discussion.)
Then I changed the code a bit to send more data (13 bytes). If data transmission is successful and sent data matches the received data then I lit the blue LEDs on the master and slave boards (in the niko_proj/SPI_polling_scb folder). All of this seems to work fine.
However, I need to use non SCB SPI components. So I mimicked the projects from niko_proj/SPI_polling_scb into niko_proj/SPI_polling_non_scb folder, and used non SCB components with their API calls in main.c. Everything builds fine, but the slave doesn't receive anything from master now.
Please help!
The workspace bundle is attached.
Thanks!
Nikolay
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Nikolay-san,
With the help of user_78878863-san, I could figure out what the problem was.
For SPIS_PutArray(), we needed to do
SPIS_WriteTxDataZero(buffer[0]) ;
SPIS_PutArray( &buffer[1], size_of_buffer - 1 );
This was described in the datasheet of SPIS, which I failed to find.
========================
void SPIS_WriteTxDataZero(uint8/uint16 txData)
Description:
Places a byte/word directly into the shift register for transmission.
This byte/word will be sent to the master device during the next clock phase.
Parameters:
uint8/uint16: txData: The data value to send across the SPI
Side Effects:
Required for modes where CPHA == 0 where data must be in the shift register before the first clock edge.
Firmware must control this if there is already data being shifted out and if there is more
========================
Meantime, during the debugging I organized names of some buffers
as my memory can not put up with the maze of tmp, dummy... etc.
So I name buffers for SPI_Master as mTxBuffer, mRxBuffer, mFillBuffer
and buffers SPI_Slave sTxBuffer, sRxBuffer, sFillBuffer.
Master TeraTerm log
Slave TeraTerm log
Best Regards,
11-Oct-2018
Motoo Tanaka