Jump to content
  • 0

Reset required for MicroBlaze design to start on Cmod A7 board


stunix

Question

Dear experts,

I have created a MicroBlaze-based design with Vivado 2018.2 for my Cmod A7 board. I have followed this tutorial to store my SDK project in SPI Flash.

All seems to work fine on the Cmod A7, however strangely I have to push the reset button (BTN0) of the board for the design to start running. This is necessary both right after programming as well as on normal power cycle. For example, when using the verbose mode of the bootloader, nothing is printed to the serial port when applying power to the board, unless I physically press the reset button.

Is this behavior expected? And is there a way to work around this? Since I intend to use the Cmod A7 in a project where the board buttons would not be easily accessible, it's kind of important that the design should start immediately on applying power...

Thanks for any tips & of course happy holidays to all!

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

Hi @jpeyron and others,

The issue is fixed now. The solution is described here: https://forums.xilinx.com/t5/Embedded-Processor-System-Design/Issue-with-Booting-from-QSPI-Flash-using-SREC-SPI-Bootloader-for/td-p/687593 (post from bhall0107 on 12-28-2018 at 02:54 PM).

In short, changing the AXI SPI from "Quad" to "Standard" in the block design and setting the Bitstream Configuration Mode to 'Master SPI x1' solves the issue. When power cycling the Cmod A7 board now (both through USB or power pins), the bootloader starts and the program executes automatically, without the need for pressing any buttons.

Thank you @jpeyron for the support provided!

Link to comment
Share on other sites

Hi @stunix,

Welcome to the forums! How are you removing power from the Cmod A7?  Are you powering the Cmod A7 through the USB UART or through the external power supply attached to pins 24 and 25 of the DIP connector, labeled “VU” and “GND”, respectively. If through the pins 25 and 25, what voltage/amps are you using? Can you attach the verbose text sent through the USB UART? 

thank you,

Jon

Link to comment
Share on other sites

Hi @jpeyron,

Thank you for your reply.

I have tried powering the Cmod A7 both through USB (in which case a power cycle consists of disconnecting and reconnecting the board to a USB port of my pc) and through the pins in a breadboard-like setup, where I applied 5V/1A to the pins with my lab power supply. I have the same issue in both cases, though I should add that in case of applying power using the pins, USB is obviously not connected, so my test consisted of measuring some of the GPIO pins that were supposed to be set to 1 in my main.c.

In case of power through USB, I had to press BTN0 to get anything on Tera Term. In case of power through the pins, the GPIO pins set to 1 only actually became high after pressing BTN0 (with some delay, but that is expected).

When testing through USB, the verbose text sent through UART is (when the bootloader has finished):

SREC SPI Bootloader
Loading SREC image from flash @ address: 00300000
Bootloader: Processed (0x)000000ec S-records
Executing program starting at address: 00000000

This text only starts appearing after pressing BTN0.

Thanks for your support!

Link to comment
Share on other sites

Hi @stunix,

Here is a verified hello world sdk Cmod A7 qspi project done in vivado 2017.4. That goes on power up without needing to press a button. Please try this project and see if it works as expected. You might need to add a delay in your project to ensure all of the power rails are powered up before the board is being configured through the qspi.

thank you,

Jon

 

Link to comment
Share on other sites

Hi @jpeyron,

Thanks for this.

In fact, I had found this project linked in another thread some time ago, and used it as a starting point for my own project. Consequently, both projects are quite similar.

In any case, I have tried your project again and I can indeed confirm that it works as expected, i.e. it starts immediately when applying power without pressing any buttons.

I've tried to find any meaningful differences between both projects, both in hardware and software/bootloader, but could not find anything that would explain why one works as it should and the other doesn't...

Quote

You might need to add a delay in your project to ensure all of the power rails are powered up before the board is being configured through the qspi.

Not sure what you mean exactly or how I would go about doing this. Again, my project is basically an extension of yours, so in almost all respects they are very similar if not identical. Having said that, obviously there are some differences, apparently including a change that causes my project not to start without the button press.

Thank you for any additional advice you might have.

Link to comment
Share on other sites

Hi @stunix,

Adding an initial delay in the beginning of the SDK code can sometimes help if the application is trying to run before all of the power rails are fully up. This can be an issue when the verbose is commented out. 

Could you post a screen shot of your Block design, the wrapper file and the SDK code?

thank you,

Jon 

Link to comment
Share on other sites

Hi @stunix,

i am  not seeing an issue with your sdk code. Attached below is some verified GPIO sdk code that is for the zybo that uses the buttons,switches and usb uart that might be helpful. Have you tried different pins on the CmodA7?  When do you see the verbose text print? After you press the button or on power up?

cheers,

Jon

/*****************************************************
Getting Started Guide for Zybo
 
This demo displays the status of the switches on the
LEDs and prints a message to the serial communication
when a button is pressed.
 
Terminal Settings:
   -Baud: 115200
   -Data bits: 8
   -Parity: no
   -Stop bits: 1
 
1/6/14: Created by MarshallW
****************************************************/
 
#include <stdio.h>
#include "platform.h"
#include <xgpio.h>
#include "xparameters.h"
#include "sleep.h"
 
int main()
{
   XGpio input, output;
   int button_data = 0;
   int switch_data = 0;
 
   XGpio_Initialize(&input, XPAR_AXI_GPIO_0_DEVICE_ID);	//initialize input XGpio variable
   XGpio_Initialize(&output, XPAR_AXI_GPIO_1_DEVICE_ID);	//initialize output XGpio variable
 
   XGpio_SetDataDirection(&input, 1, 0xF);			//set first channel tristate buffer to input
   XGpio_SetDataDirection(&input, 2, 0xF);			//set second channel tristate buffer to input
 
   XGpio_SetDataDirection(&output, 1, 0x0);		//set first channel tristate buffer to output
 
   init_platform();
 
   while(1){
      switch_data = XGpio_DiscreteRead(&input, 2);	//get switch data
 
      XGpio_DiscreteWrite(&output, 1, switch_data);	//write switch data to the LEDs
 
      button_data = XGpio_DiscreteRead(&input, 1);	//get button data
 
      //print message dependent on whether one or more buttons are pressed
      if(button_data == 0b0000){} //do nothing
 
      else if(button_data == 0b0001)
         xil_printf("button 0 pressed\n\r");
 
      else if(button_data == 0b0010)
         xil_printf("button 1 pressed\n\r");
 
      else if(button_data == 0b0100)
         xil_printf("button 2 pressed\n\r");
 
      else if(button_data == 0b1000)
         xil_printf("button 3 pressed\n\r");
 
      else
         xil_printf("multiple buttons pressed\n\r");
 
      usleep(200000);			//delay
 
   }
   cleanup_platform();
   return 0;
}

 

Link to comment
Share on other sites

Hi @jpeyron,

The verbose text appears only on button press, not on power on. I have tried several different pins, all give the same result (they are only set after button press).

Do you think it might have something to do with the OS version of the bootloader (6.5 in your sample and 6.7 in my project)? Is there any way to configure newer projects with the older version?

Thanks!

Link to comment
Share on other sites

Hi @jpeyron,

First of all, best wishes for the new year!

Thanks for creating this project. Unfortunately, the problem persists. After programming the Cmod A7 and disconnecting/reconnecting the board, I see the following on Tera Term:

SREC SPI Bootloader

Nothing appears to happen after that. However, when pressing BTN0, suddenly the bootloader springs to life and I see the following on Tera Term (when finished):

SREC SPI Bootloader
Loading SREC image from flash @ address: 00300000
Bootloader: Processed (0x)000001bd S-records
Executing program starting at address: 00000000

When pressing BTN0 again after the bootloader has finished, I get:

input received

Interestingly, if I don't press any button, I don't receive the "no input received" text which I would expect.

Link to comment
Share on other sites

I am now currently battling this problem.  I debugged it to a call to XIsf_GetDeviceInfo in the bootloader  code (called from XIsf_Initialize) that does not fail, but does not return the correct manufacturer and device ID.  Further calls then fail.

I tried the fix above (using the standard SPI interface) which worked.  I also found that a configuration using the quad SPI interface worked so long as the extended performance mode was selected on the AXI_QUAD_SPI block (which then uses a full AXI bus to the IP, not an AXI_LITE bus)

I suspect there is a bug in the IP somewhere.

Hope this helps.

G.

 

Link to comment
Share on other sites

On 12/26/2018 at 1:32 PM, jpeyron said:

Hi @stunix,

Here is a verified hello world sdk Cmod A7 qspi project done in vivado 2017.4. That goes on power up without needing to press a button. Please try this project and see if it works as expected. You might need to add a delay in your project to ensure all of the power rails are powered up before the board is being configured through the qspi.

thank you,

Jon

 

This example works with CMOD A7-35. Thanks for the excellent example as I have been struggling to start from sdk with quad SPI flash programming.

I noticed that spi clk is 50 MHz, instead of 100 MHz from the system. Any reason for that or it is ok to drive SPI clock at 100 MHz?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...