Hi guys,
I am beginner at Embedded system and also at Kinetis Design Studio. I am using DIY Board with MKL27Z256 microcontroller.
1) I test spi transfer with 'polling spi b2b transfer master' example.
I printed out the result of sent and received data on semihosting console window.
My sending data was srcBuff[i] = i; from 0 to buffer size with for function and my received data was initialised as 0. But I got error with the received value 255, not following sent data.
for example,
srcBuff[4] = 4
desBuff[4] = 255
The 4 data is wrong, the data received is 255
I used SPI_MasterTransferBlocking like below.
SPI_MasterGetDefaultConfig(&Mconfig);
srcFreq = CLOCK_GetFreq(kCLOCK_BusClk);
SPI_MasterInit(SPI1, &Mconfig, srcFreq); //initialising
transfer.dataSize = BUFFER_SIZE;
transfer.rxData = destBuff;
transfer.txData = srcBuff;
transfer.flags = SPI_GetStatusFlags(SPI1);
SPI_MasterTransferBlocking(SPI1, &transfer);
Can you help me that problem and explain how the function works, when it is available?
I saw also that code, but sadly not helped.
2) When I made a new project with SDK v2.x, I got errors with unclaired variables.
SIM->SOPT5 = ((SIM->SOPT5 &
(~(SIM_SOPT5_UART0TXSRC_MASK))) /* Mask bits to zero which are setting */
| SIM_SOPT5_UART0TXSRC(SOPT5_UART0TXSRC_UART_TX) /* UART 0 transmit data source select: UART0_TX pin */
);
I changed it like that from a example.
SIM->SOPT5 = ((SIM->SOPT5 &
(~(SIM_SOPT5_LPUART0TXSRC_MASK))) /* Mask bits to zero which are setting */
| SIM_SOPT5_LPUART0TXSRC(SOPT5_UART0TXSRC_UART_TX) /* UART 0 transmit data source select: UART0_TX pin */
| SIM_SOPT5_LPUART0RXSRC(SOPT5_UART0RXSRC_UART_RX) /* UART 0 receive data source select: UART0_RX pin */
);
But I am not sure, whether it is also right.
Which function has this variable and what should I check or mind when I want to change the variables?
Have a nice sunday!