Hii,
I am currently working on frdm k64f board.. I am using MQX 4.2 with IAR.. I want to communicate with SPI in 9bit data transfer. The data transfer in frame size of 8 bit is ok. but when i change the frame size as
param = 9; /* Set framesize to 9*/
printf("Setting framesize to %d ", param);
if (SPI_OK == ioctl(spifd, IO_IOCTL_SPI_SET_FRAMESIZE, ¶m)) {
printf("OK\n");
} else {
printf("ERROR\n");
}
printf("Getting framesize ... "); /* Get transfer mode */
if (SPI_OK == ioctl(spifd, IO_IOCTL_SPI_GET_FRAMESIZE, ¶m)) {
printf("%d\n", param);
} else {
printf("ERROR\n");
}
the data transfer is not happening..
I have also tried changing the frame size in init_spi.c file , it was also unsuccessful.
anyone please help
Hi ANJU ANTONY,
BTW, I highly recommend you test this SPI bit function without the MQX, just use the baremetal code.
You can test it based on the K64 sdk code.
If you still have question about it, I will check it on my FRDM-K64 board.
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi ANJU ANTONY,
Do you debug your code, and check the SPI register?
SPIx_CTARn[FRMSZ]= 8 if you want to send 9 bit data.
Please debug, and check the register directly.
Maybe your register is not modified.
Wish it helps you!
If you still have question about it, please send me your debug result.
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi,
Thank you for your reply,
I have debug my code,
The register value SPI0_CTAR0 is
SPI0_CTAR0_SPI0 0x40005506 ReadWrite
DBR 0 ReadWrite
FMSZ 0x8 ReadWrite
CPOL 0 ReadWrite
CPHA 0 ReadWrite
LSBFE 0 ReadWrite
PCSSCK 0x0 ReadWrite
PASC 0x0 ReadWrite
PDT 0x0 ReadWrite
PBR 0x0 ReadWrite
CSSCK 0x5 ReadWrite
ASC 0x5 ReadWrite
DT 0x0 ReadWrite
BR 0x6 ReadWrite
so the frame size changes in the register.
Also the frame size changes when set to 7 bit.The problem is when setting above 8 bit value.
Hi ANJU ANTONY,
Thank you for your updated information.
Could you give me the SPI bus wave when you set the bit above 8 bit value, eg. 8 bit, 9bit. ect. Please also give me the 7 bit SPI bus wave, especially the SPI_CLK.
Then I will help you to check it.
When you test it, please also give me the debug result picture about the SPIx_CTARn[FRMSZ].
Waiting for your updated information.
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------