added flash reset before reading config info
This commit is contained in:
Binary file not shown.
@@ -350,6 +350,28 @@ int config_flash_read(u32 Addr, u8 * data, u32 ByteCount)
|
|||||||
return XST_SUCCESS;
|
return XST_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int config_flash_read_id(void)
|
||||||
|
{
|
||||||
|
int Status;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Read ID in Auto mode.*/
|
||||||
|
WriteBuffer[BYTE1] = 0x9f;
|
||||||
|
WriteBuffer[BYTE2] = 0xff; /* 4 dummy bytes */
|
||||||
|
WriteBuffer[BYTE3] = 0xff;
|
||||||
|
WriteBuffer[BYTE4] = 0xff;
|
||||||
|
WriteBuffer[BYTE5] = 0xff;
|
||||||
|
|
||||||
|
Status = XSpi_Transfer(&Spi, WriteBuffer, ReadBuffer, 5);
|
||||||
|
if (Status != XST_SUCCESS) {
|
||||||
|
return XST_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
xil_printf("FlashID=0x%x 0x%x 0x%x\n\r", ReadBuffer[1], ReadBuffer[2], ReadBuffer[3]);
|
||||||
|
|
||||||
|
return XST_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int config_flash_read_config(void) {
|
int config_flash_read_config(void) {
|
||||||
|
|
||||||
@@ -408,6 +430,13 @@ int config_flash_init(void) {
|
|||||||
int Status;
|
int Status;
|
||||||
XSpi_Config *ConfigPtr; /* Pointer to Configuration data */
|
XSpi_Config *ConfigPtr; /* Pointer to Configuration data */
|
||||||
|
|
||||||
|
// Reset QSPI
|
||||||
|
Xil_Out32(0x40050008, (1 << 10));
|
||||||
|
vTaskDelay(100);
|
||||||
|
Xil_Out32(0x40050008, 0);
|
||||||
|
vTaskDelay(100);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the SPI driver so that it's ready to use,
|
* Initialize the SPI driver so that it's ready to use,
|
||||||
* specify the device ID that is generated in xparameters.h.
|
* specify the device ID that is generated in xparameters.h.
|
||||||
@@ -468,6 +497,9 @@ int config_flash_init(void) {
|
|||||||
XSpi_Start(&Spi);
|
XSpi_Start(&Spi);
|
||||||
|
|
||||||
// config_flash_read_config();
|
// config_flash_read_config();
|
||||||
|
config_flash_read_id();
|
||||||
|
config_flash_read_id();
|
||||||
|
config_flash_read_id();
|
||||||
|
|
||||||
return XST_SUCCESS;
|
return XST_SUCCESS;
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,9 @@ static void pps_irq_handler(u32 context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main_task( void *pvParameters ) {
|
void main_task( void *pvParameters ) {
|
||||||
|
|
||||||
|
config_flash_init();
|
||||||
|
|
||||||
// Connect PPS Interrupt
|
// Connect PPS Interrupt
|
||||||
xPortInstallInterruptHandler(XPAR_MICROBLAZE_0_AXI_INTC_SYSTEM_PPS_INTR, (XInterruptHandler) pps_irq_handler, (void *)0);
|
xPortInstallInterruptHandler(XPAR_MICROBLAZE_0_AXI_INTC_SYSTEM_PPS_INTR, (XInterruptHandler) pps_irq_handler, (void *)0);
|
||||||
vPortEnableInterrupt(XPAR_MICROBLAZE_0_AXI_INTC_SYSTEM_PPS_INTR);
|
vPortEnableInterrupt(XPAR_MICROBLAZE_0_AXI_INTC_SYSTEM_PPS_INTR);
|
||||||
@@ -127,7 +130,7 @@ int main(void) {
|
|||||||
xil_printf("\n\r\n\r================= Start ====================\n\r\n\r");
|
xil_printf("\n\r\n\r================= Start ====================\n\r\n\r");
|
||||||
|
|
||||||
Xil_Out32(GPO_REG, 0x11);
|
Xil_Out32(GPO_REG, 0x11);
|
||||||
config_flash_init();
|
// config_flash_init();
|
||||||
|
|
||||||
xTaskCreate( status_task,
|
xTaskCreate( status_task,
|
||||||
( const char * ) "status",
|
( const char * ) "status",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -157,3 +157,21 @@ bsp write
|
|||||||
bsp reload
|
bsp reload
|
||||||
catch {bsp regenerate}
|
catch {bsp regenerate}
|
||||||
platform generate -domains freertos10_xilinx_microblaze_0
|
platform generate -domains freertos10_xilinx_microblaze_0
|
||||||
|
bsp config stdin "mdm_1"
|
||||||
|
bsp config stdout "mdm_1"
|
||||||
|
bsp write
|
||||||
|
bsp reload
|
||||||
|
catch {bsp regenerate}
|
||||||
|
platform generate -domains freertos10_xilinx_microblaze_0
|
||||||
|
platform active {top}
|
||||||
|
bsp reload
|
||||||
|
bsp reload
|
||||||
|
bsp config stdin "none"
|
||||||
|
bsp config xil_interrupt "false"
|
||||||
|
bsp config stdout "mdm_1"
|
||||||
|
bsp config stdin "axi_uartlite_0"
|
||||||
|
bsp config stdout "axi_uartlite_0"
|
||||||
|
bsp write
|
||||||
|
bsp reload
|
||||||
|
catch {bsp regenerate}
|
||||||
|
platform generate -domains freertos10_xilinx_microblaze_0
|
||||||
|
|||||||
Reference in New Issue
Block a user