Tool/software:
Dear TI Team,
I have SPI enabled W25Q80DV Flash and trying to read and write operation with MSPM03507 launchpad. I am starting with trying to reading the manufacture ID of the flash. I took the example code form the MSPM0 SDK for spi_controller_multibyte_fifo_poll and just changed the TX values. The problem is that I get only garbage value 0xFF. On further investigation with oscilloscope, I understood that with the same code flashed either of these two conditions occur
- based on snapshot, the CS pin (red) goes high with SYSCFG_DL_init function, in DL_SPI_fillTXFIFO8() function it goes low for an instance with one short CLK (blue) pulse then CS goes high again with CLK stopped
- based on snapshot2, the CS pin (red) goes high with SYSCFG_DL_init function, but then never goes low during the DL_SPI_fillTXFIFO8(), with one short pulse on CLK (blue) pin
#include "ti_msp_dl_config.h"
/*
* Number of bytes for SPI packet size
* The packet will be transmitted by the SPI controller.
* This example uses FIFOs with polling, and the maximum FIFO size is 4.
* Refer to interrupt examples to handle larger packets.
*/
#define SPI_PACKET_SIZE_TX (4)
#define SPI_PACKET_SIZE_RX (2)
/* Data for SPI to transmit */
//uint8_t gTxPacket[SPI_PACKET_SIZE] = {'M', 'S', 'P', '!'};
uint8_t gTxPacket[SPI_PACKET_SIZE_TX] = {0x90, 0x00, 0x00, 0x00};
/* Data received from SPI Peripheral */
volatile uint8_t gRxPacket[SPI_PACKET_SIZE_RX];
int main(void)
{
SYSCFG_DL_init();
/* Fill TX FIFO with data and transmit to SPI Peripheral */
DL_SPI_fillTXFIFO8(SPI_0_INST, &gTxPacket[0], SPI_PACKET_SIZE_TX);
// DL_SPI_transmitDataBlocking8(SPI_0_INST, gTxPacket[0]);
/* Wait until all bytes have been transmitted and the TX FIFO is empty */
while (DL_SPI_isBusy(SPI_0_INST));
/*
* Wait to receive the SPI data
* This loop expects SPI_PACKET_SIZE bytes
*/
for (uint8_t i = 0; i < SPI_PACKET_SIZE_RX; i++) {
DL_SPI_transmitDataBlocking8(SPI_0_INST, 0xFF);
while (DL_SPI_isBusy(SPI_0_INST));
gRxPacket[i] = DL_SPI_receiveDataBlocking8(SPI_0_INST);
}
/*
* If this example is used with the spi_peripheral_multibyte_fifo_poll
* example, the expected data to receive in gRxPacket is
* {0x01, 0x02, 0x03, 0x04}.
*/
/* If write and read were successful, toggle LED */
while (1) {
DL_GPIO_togglePins(GPIO_LEDS_PORT,
GPIO_LEDS_USER_LED_1_PIN | GPIO_LEDS_USER_TEST_PIN);
delay_cycles(16000000);
}
}
Reference: e2e.ti.com/.../lp-mspm0g3507-spi-communication-with-nor-flash