Part Number: CC2640R2F
Tool/software: Code Composer Studio
Hi,
I am using an External Flash, IS25LP256D which is interfaced with a custom board havingCC2640R2F MCU. I used SPI protocol to communicate with MCU and External Flash.
First of all I tried to read the ID of the external flash by sending the instruction specified in the datasheet of flash. i.e 0xAB or 0x90. But, i am getting a value in the rxbuff as ' 2 ', which is not referred in the datasheet.
The MOSI, CLK and CS lines are checked with DSO and I am getting waveform which are identical to expected wave forms from other forums and tutorials. Form this I hope there is no hardware or PIn assignment issue.
But, I was not able to write or read a character or integer from the External Flash.
Here, I am attaching the Code for the same. Kindly share your ideas to check whether I am doing this in the right way.
/*---------------------------------SPI Initialization--------------------------*/
void spi_init()
{
//PIN_init(BoardGpioInitTable);
/* Open LED pins */
pinHandle = PIN_open(&pinState, spipinTable);
if(!pinHandle) {
System_abort("Error initializing board pins\n");
}
spiParams.mode = SPI_MASTER;
spiParams.dataSize = 8;
spiParams.transferMode = SPI_MODE_BLOCKING;
spiParams.transferTimeout = SPI_WAIT_FOREVER;
spiParams.bitRate = 1000000;IT WAS 12000000 THEN I CHANGED TO 600000 BUT THERE WAS NO EFFECT.
spiParams.custom =(uintptr_t) NULL;
spiParams.frameFormat = SPI_POL1_PHA1;
spiParams.transferCallbackFxn = NULL;
//SPI_Params_init(&spiParams); // Initialize SPI parameters
// 8-bit data size
SPI_init(); // Initialize the SPI driver
spi = SPI_open(Board_SPI0, &spiParams);
if (spi == NULL)
System_abort("Error initializing spi\n"); // SP
printf("spi initialised\n");
}
/*-----------------------------------PIN Initilization---------------------------------*/
CC2640R2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
CC2640R2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
CC2640R2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
I configured the CS pin as DIO_18.
/* SPI Board */
#define CC2640R2_LAUNCHXL_SPI0_MISO IOID_19 /* RF1.20 */
#define CC2640R2_LAUNCHXL_SPI0_MOSI IOID_16 /* RF1.18 */
#define CC2640R2_LAUNCHXL_SPI0_CLK IOID_17 /* RF1.16 */
#define CC2640R2_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED
Please Help.