Hi,
Based on BSP downloaded from here:
download.analog.com/.../ADI_EV-SC59x_EZ-KIT-Rel4.0.0.exe
and examples from
[Installation path]\Analog Devices\EV-SC59x_EZ-KIT-Rel4.0.0\EV-SC59x_EZ-KIT\Examples\drivers\ospi\ospi_flashdirectaccess
I tried the code snippet mentioned. Further modified a few things of the ADI_OSPI_DAC_CMD DAC_Read_Command2 and tried.
The aim is to Read from Flash using memory mapped IO from address specified like 0x60005800.
I am trying only Read from Flash via Direct Access Control. Non-DMA mode is intended.
However, no data is being read. All values are zeros.
However, the result of driver function calls are all ADI_OSPI_SUCCESS.
Attached herewith in the .txt file are the various code snippet modifications done. They mainly differ in the parameters assigned to DAC_Read_Command2.
Can you please let me know what is likely to have been missed and why only zeros are obtained in the ReadBuffer?
Thanks,
=========================== Modification Case 1: =========================== ADI_OSPI_DAC_CMD DAC_Read_Command2; #if 1 /* Buffer into which the data from Flash is read in to */ #define READBUFFSIZE 0x128 uint8_t ReadBuff[READBUFFSIZE]; ADI_OSPI_RESULT eResult = ADI_OSPI_SUCCESS; uint8_t nDriver_Memory[ADI_OSPI_MEMORY_SIZE + ADI_SPU_MEMORY_SIZE]; #define MDMA_CHANNEL_USED ADI_DMA_MEMDMA_S0 /* Initialize OSPI controller */ //if(Ospi_initialize() != 0U) // return 0; /* Handle for OSPI driver */ uint32_t HandleMem = 0; ADI_OSPI_HANDLE *phDevice = (ADI_OSPI_HANDLE*)&HandleMem; DAC_Read_Command2.CmdOpcode = 0x03; // /*(0x0B)Fast Read mode */ /*(0x03)Normal Read mode */ DAC_Read_Command2.CmdOpcode2 = 0; DAC_Read_Command2.eBusMode = ADI_OSPI_SINGLE; DAC_Read_Command2.eTransferMode = ADI_OSPI_TRANSFERMODE_STR; DAC_Read_Command2.eOperatingMode = OSPI_ADI_COREMODE; DAC_Read_Command2.eAddrSize = ADI_OSPI_CMD_ADDR_SIZE_3; DAC_Read_Command2.NumOfDummyCycles = 8; DAC_Read_Command2.ModeDataEnable = 1; // check for 0 DAC_Read_Command2.ModeData = 0; DAC_Read_Command2.pSource = (uint8_t *)0x60000000; DAC_Read_Command2.pDestination = (uint8_t *)ReadBuff; DAC_Read_Command2.nCount = READBUFFSIZE; // tried 16 earlier eResult = adi_ospi_Open((uint8_t *)nDriver_Memory + ADI_SPU_MEMORY_SIZE, ADI_OSPI_MEMORY_SIZE, OSPI_ADI_MDMAUSED, MDMA_CHANNEL_USED, phDevice ); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to Open OSPI driver. Error code returned %d \n", eResult); return -1; } eResult = adi_ospi_ConfigBaud(*phDevice, ADI_OSPI_BAUD_DIV_BY_32); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to update the Baud rate. Error code returned %d \n", eResult); return -1; } eResult = adi_ospi_UpdateReadDelay(*phDevice, 8); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to update the Read delay capture value. Error code returned %d \n", eResult); return -1; } /* Perform the read operation in the configured mode of OSPI and flash */ eResult = adi_ospi_DirectRead( *phDevice, &DAC_Read_Command2); if(eResult != ADI_OSPI_SUCCESS) { printf("Error occurred in OSPI Direct Read. Error code returned %d \n", eResult); printf("Fail \n"); return 0; } /* Close the OPSI driver */ eResult = adi_ospi_Close(*phDevice); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to Close OSPI driver. Error code returned %d \n", eResult); printf("Fail \n"); return 0; } #else ================================================================================== Modification #2: Changed the source address to 0x5800 ADI_OSPI_DAC_CMD DAC_Read_Command2; #if 1 /* Buffer into which the data from Flash is read in to */ #define READBUFFSIZE 128U uint8_t ReadBuff[READBUFFSIZE]; ADI_OSPI_RESULT eResult = ADI_OSPI_SUCCESS; uint8_t nDriver_Memory[ADI_OSPI_MEMORY_SIZE + ADI_SPU_MEMORY_SIZE]; #define MDMA_CHANNEL_USED ADI_DMA_MEMDMA_S0 /* Initialize OSPI controller */ //if(Ospi_initialize() != 0U) // return 0; /* Handle for OSPI driver */ uint32_t HandleMem = 0; ADI_OSPI_HANDLE *phDevice = (ADI_OSPI_HANDLE*)&HandleMem; DAC_Read_Command2.CmdOpcode = 0x03; // /*(0x0B)Fast Read mode */ /*(0x03)Normal Read mode */ DAC_Read_Command2.CmdOpcode2 = 0; DAC_Read_Command2.eBusMode = ADI_OSPI_SINGLE; DAC_Read_Command2.eTransferMode = ADI_OSPI_TRANSFERMODE_STR; DAC_Read_Command2.eOperatingMode = OSPI_ADI_COREMODE; DAC_Read_Command2.eAddrSize = ADI_OSPI_CMD_ADDR_SIZE_3; DAC_Read_Command2.NumOfDummyCycles = 8; DAC_Read_Command2.ModeDataEnable = 1; // check for 0 DAC_Read_Command2.ModeData = 0; DAC_Read_Command2.pSource = (uint8_t *)0x00005800; // Tried this also (uint8_t *)0x60000000; DAC_Read_Command2.pDestination = (uint8_t *)ReadBuff; DAC_Read_Command2.nCount = READBUFFSIZE; // tried 16 earlier eResult = adi_ospi_Open((uint8_t *)nDriver_Memory + ADI_SPU_MEMORY_SIZE, ADI_OSPI_MEMORY_SIZE, OSPI_ADI_MDMAUSED, MDMA_CHANNEL_USED, phDevice ); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to Open OSPI driver. Error code returned %d \n", eResult); return -1; } eResult = adi_ospi_ConfigBaud(*phDevice, ADI_OSPI_BAUD_DIV_BY_32); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to update the Baud rate. Error code returned %d \n", eResult); return -1; } eResult = adi_ospi_UpdateReadDelay(*phDevice, 8); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to update the Read delay capture value. Error code returned %d \n", eResult); return -1; } /* Perform the read operation in the configured mode of OSPI and flash */ eResult = adi_ospi_DirectRead( *phDevice, &DAC_Read_Command2); if(eResult != ADI_OSPI_SUCCESS) { printf("Error occurred in OSPI Direct Read. Error code returned %d \n", eResult); printf("Fail \n"); return 0; } /* Close the OPSI driver */ eResult = adi_ospi_Close(*phDevice); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to Close OSPI driver. Error code returned %d \n", eResult); printf("Fail \n"); return 0; } #else ============================================================================ Modification #3: Made NumOfDummyCycles, ModeDataEnable and ModeData all 0. ADI_OSPI_DAC_CMD DAC_Read_Command2; #if 1 /* Buffer into which the data from Flash is read in to */ #define READBUFFSIZE 128U uint8_t ReadBuff[READBUFFSIZE]; ADI_OSPI_RESULT eResult = ADI_OSPI_SUCCESS; uint8_t nDriver_Memory[ADI_OSPI_MEMORY_SIZE + ADI_SPU_MEMORY_SIZE]; #define MDMA_CHANNEL_USED ADI_DMA_MEMDMA_S0 /* Initialize OSPI controller */ //if(Ospi_initialize() != 0U) // return 0; /* Handle for OSPI driver */ uint32_t HandleMem = 0; ADI_OSPI_HANDLE *phDevice = (ADI_OSPI_HANDLE*)&HandleMem; DAC_Read_Command2.CmdOpcode = 0x03; // /*(0x0B)Fast Read mode */ /*(0x03)Normal Read mode */ DAC_Read_Command2.CmdOpcode2 = 0; DAC_Read_Command2.eBusMode = ADI_OSPI_SINGLE; DAC_Read_Command2.eTransferMode = ADI_OSPI_TRANSFERMODE_STR; DAC_Read_Command2.eOperatingMode = OSPI_ADI_COREMODE; DAC_Read_Command2.eAddrSize = ADI_OSPI_CMD_ADDR_SIZE_3; DAC_Read_Command2.NumOfDummyCycles = 0; DAC_Read_Command2.ModeDataEnable = 0; // check for 0 DAC_Read_Command2.ModeData = 0; DAC_Read_Command2.pSource = (uint8_t *)0x00005800; // Tried this also (uint8_t *)0x60000000; DAC_Read_Command2.pDestination = (uint8_t *)ReadBuff; DAC_Read_Command2.nCount = READBUFFSIZE; // tried 16 earlier eResult = adi_ospi_Open((uint8_t *)nDriver_Memory + ADI_SPU_MEMORY_SIZE, ADI_OSPI_MEMORY_SIZE, OSPI_ADI_MDMAUSED, MDMA_CHANNEL_USED, phDevice ); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to Open OSPI driver. Error code returned %d \n", eResult); return -1; } eResult = adi_ospi_ConfigBaud(*phDevice, ADI_OSPI_BAUD_DIV_BY_32); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to update the Baud rate. Error code returned %d \n", eResult); return -1; } eResult = adi_ospi_UpdateReadDelay(*phDevice, 8); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to update the Read delay capture value. Error code returned %d \n", eResult); return -1; } /* Perform the read operation in the configured mode of OSPI and flash */ eResult = adi_ospi_DirectRead( *phDevice, &DAC_Read_Command2); if(eResult != ADI_OSPI_SUCCESS) { printf("Error occurred in OSPI Direct Read. Error code returned %d \n", eResult); printf("Fail \n"); return 0; } /* Close the OPSI driver */ eResult = adi_ospi_Close(*phDevice); if(eResult != ADI_OSPI_SUCCESS) { printf("Failed to Close OSPI driver. Error code returned %d \n", eResult); printf("Fail \n"); return 0; } #else