I am developin my application with CW 10.4 and MQX 4.0.2 on my K60-base custom board.
I used SPIMaster_LDD in my BSP to communicate with 2 data-flash memories through SPI0 in Mode-3.
Now I was asked to add an SD card connected to the same SPI0 bus and to mount a file system on it.
I have 2 problem to face:
Should I use MQX IO SPI driver in my BSP for all thedevices connected to the SPI0 bus?
Hello,
Where did you find the SD card demo based on the SPI?
Thanks.
-Daniel
Regarding using Filesystem, I don't know it there is a possibility to connect to MQX filesysten, but you can see this article that shows how to communicate with SD card and use File-system with Processor Expert on FRDM-KL25:
Arduino Data-Logger Shield with the FRDM-KL25Z Board | MCU on Eclipse
best regards
Petr Hradsky
Processor Expert Support Team
There is another tutorial which uses SPI SD Card and W5100 on the same SPI bus:
FRDM with Arduino Ethernet Shield R3, Part 2: Ping | MCU on Eclipse
HI, I am very new to Freescale Kinetic microcontrollers. I am working on FRDM-k20d50m development board and trying to develop an application to interface two slaves on this development board. My requirement is to send data to 1st slave and then receive data from the same slave and then to deploy same operation on 2nd slave. If I am using one slave at a time and disconnect the other one then it works fine but if I connect two slaves the at same time I am not receiving any data from slave. The basic code to initiate SPI communication between two slaves is as below:
/* Below block of code writes/reads data from first slave*/
SM1_SelectConfiguration(SPI, ChipSelect, AttributeSet);
SM1_SendBlock(SPI, out_data, sizeof (out_data));
SM1_ReceiveBlock(SPI, &in_data, sizeof (in_data));
/* Below block of code writes/reads data from second slave*/
SM1_SelectConfiguration(SPI, ChipSelect_1, AttributeSet_1);
SM1_SendBlock(SPI, out_data, sizeof (out_data));
SM1_ReceiveBlock(SPI, &in_data_1, sizeof (in_data_1));
Please help me to make the communication possible with two slaves at the same time with proper toggling.
Hi,
I think there are two issues here:
1. You need to call ReceiveBlock first instead of what you have in your post, because the clock is generated after the transfer is performed.
2. Your code does not wait for the result. Please note that the component methods do not wait for the operation to end, the transfer just puts the value to the HW output buffer. You can use SM1_GetBlockReceivedStatus method for checking that the data are completely sent.
It should look like this:
Error = SM1_ReceiveBlock(MySPIPtr, InpData, BLOCK_SIZE); /* Request data block reception */
Error = SM1_SendBlock(MySPIPtr, OutData, BLOCK_SIZE); /* Start transmission/reception */
while (!SM1_GetBlockReceivedStatus(MySPIPtr)) {}; // wait for the transaction to finish
...
You can find examples at the Typical usage page of the SPIMaster_LDD component help which you can get using the pop-up menu command "Help on component"
best regards
Petr Hradsky
Processor Expert Support Team