Hello,
2 issues on KE02 SPI reference manual I don't understand:
1) SPIx_S[MODF]: What content should I write in C1?
2) SPIx_S[SPMF]
The problem is that register is read only, as stated here.
So, how can I clear SPMF?
Best Regards
Roberto
解決済! 解決策の投稿を見る。
Hello Roberto,
if (SPI0->S & SPI_S_MODF_MASK)
{
uint8_t temp = SPI0->C1 | SPI_C1_MSTR_MASK;
SPI0->C1 = temp;
}
Or simply:
if (SPI0->S & SPI_S_MODF_MASK)
{
SPI0->C1 |= SPI_C1_MSTR_MASK;
}
Remember that in order to clear this flag, MODF condition must be removed (SS input should detect a high level voltage), otherwise, this MODF flag won't be cleared.
This way you will be able to write to this register and clear the flag:
if (SPI0->S & SPI_S_SPMF_MASK)
{
SPI0->S |= SPI_S_SPMF_MASK;
}
I hope this can help you!
Have a nice day!
Regards,
Isaac
Hello Roberto,
if (SPI0->S & SPI_S_MODF_MASK)
{
uint8_t temp = SPI0->C1 | SPI_C1_MSTR_MASK;
SPI0->C1 = temp;
}
Or simply:
if (SPI0->S & SPI_S_MODF_MASK)
{
SPI0->C1 |= SPI_C1_MSTR_MASK;
}
Remember that in order to clear this flag, MODF condition must be removed (SS input should detect a high level voltage), otherwise, this MODF flag won't be cleared.
This way you will be able to write to this register and clear the flag:
if (SPI0->S & SPI_S_SPMF_MASK)
{
SPI0->S |= SPI_S_SPMF_MASK;
}
I hope this can help you!
Have a nice day!
Regards,
Isaac
Hi Isaac,
thanks a lot.
First issue is OK.
About second one: from SW point of view declaring __IO instead of __I will solve.
But from MCU side, its reference manual is reporting that SPI0_S is read only. Sometimes I used to read w1c (write 1 clear): is it just a documentation issue?
Thank you very much
Best Regards
Roberto
Hello Roberto,
It seems to me that this is a documentation error and I need to validate it with Documentation team. Because when I modified the const modifier in the header file, flag could be cleared correctly.
I hope this help
Regards,
Isaac