This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
My project is trying to use SPI1, but it stuck on
But it is working with SPI3/SPI5. I have been stuck for 3 days, didn't find the reason.
I used a blank project and setup the code, then it worked with SPI1. But I compared this project and the blank project, I didn't find a difference.
Could you please help me figure it out? Thanks
Hi Hongbo,
Just now i checked your code and found below thing:
Why didn't you configure SOMI[0]?
I don't know whether you did intentionally or not, but this is not possible. I mean you can't send data alone on SOMI[1] without SOMI[0]. At least you can send data on both the lines like as shown below.
So, please enable SOMI[0] and test it.
--
Thanks & regards,
Jagadish.
Hello, for now I only need to confirm the SPI1 CLK can work, so I do not change SOMI or others. I cannot see the SPI1 CLK signal on oscilloscope by this project code, but I can get correct CLK signal from a blank code project.
And the while I put above is checking Master out I think, so even I didn't set SOMI ( but set SIMO), it should not be stuck on it, right ?
Hi Hongbo,
And the while I put above is checking Master out I think, so even I didn't set SOMI ( but set SIMO), it should not be stuck on it, right ?
At above highlighted line we are polling the below bit:
This bit is SET to high only when a new data is received, if SPI won't receive any new data to the shift register then this bit will not SET to high and processor will always stuck at this bit. So if you don't configure the SOMI[0] as input then there won't be any possibility for receiving data right? That is the reason why your code always getting stuck at that line.
Here you can do two things, either just enable the SOMI[0] functionality and just ignore the received data if you don't want to process the data.
or else
just create another SPI transmit function in your main.c, there you can just ignore processing of this bit(RXINTFLG), instead of just poll the TXINTFLG bit and write to the data register if this bit is empty.
--
Thanks & regards,
Jagadish.
I found your screenshot is in Parallel-Mode, which is using two or more data lines, and only supported in MIBSPI5. So why it affected SPI1 ? and I used only one SIMO line.
Hi Hongbo,
I found your screenshot is in Parallel-Mode, which is using two or more data lines, and only supported in MIBSPI5.
Actually, that was a typo error.
MibSPI1 will also supports parallel mode up to 2-data lines. whereas MibSPI5 will support parallel mode up to 4-data lines.
*High Speed Serial Bus Using the MibSPIP Module on Hercules-Based Microcontrollers (ti.com)
You can confirm it same from above app notes.
And if it won't support 2 bit parallel mode then there is no point of providing two SIMO and two SOMI lines right?
So why it affected SPI1 ? and I used only one SIMO line.
If you want to use single SIMO line, then it should be SIMO[0] not SIMO[1].
--
Thanks & regards,
Jagadish.
Hi Hongbo,
Oh, I thought either one of SIMO[x] is ok for SIMO, so it is only SIMO[0].
No, either SIMO[0] or SIMO[1] is not possible.
We can use only SIMO[0] if we want to use 1-bit line mode or else we can use both SIMO[0] and SIMO[1] if we want to use 2-bit parallel mode.
--
Thanks & regards,
Jagadish.