added flash reset before reading config info

This commit is contained in:
2025-07-02 22:18:52 -05:00
parent 6dfee38d7c
commit 1ee9b4db20
5 changed files with 13047 additions and 12967 deletions

View File

@@ -350,6 +350,28 @@ int config_flash_read(u32 Addr, u8 * data, u32 ByteCount)
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) {
@@ -408,6 +430,13 @@ int config_flash_init(void) {
int Status;
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,
* specify the device ID that is generated in xparameters.h.
@@ -468,6 +497,9 @@ int config_flash_init(void) {
XSpi_Start(&Spi);
// config_flash_read_config();
config_flash_read_id();
config_flash_read_id();
config_flash_read_id();
return XST_SUCCESS;

View File

@@ -108,6 +108,9 @@ static void pps_irq_handler(u32 context) {
}
void main_task( void *pvParameters ) {
config_flash_init();
// Connect PPS Interrupt
xPortInstallInterruptHandler(XPAR_MICROBLAZE_0_AXI_INTC_SYSTEM_PPS_INTR, (XInterruptHandler) pps_irq_handler, (void *)0);
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_Out32(GPO_REG, 0x11);
config_flash_init();
// config_flash_init();
xTaskCreate( status_task,
( const char * ) "status",

File diff suppressed because it is too large Load Diff

View File

@@ -157,3 +157,21 @@ bsp write
bsp reload
catch {bsp regenerate}
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