cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jg_spitfire
Adventurer
Adventurer
284 Views
Registered: ‎12-10-2019

Program is not exiting sleep() function - ac701 board vivado 2018.3

Hi I am trying to develop an HDMI project with MicroBlaze, but in my SDK when I use the sleep() function the program stops its execution and never exit that function, I created another program with a simple "hello world" a delay of 2 seconds and then another text like "program end" and it works, I don´t know why in my HDMI project it does not work

int main(void)
{
	int Status;
	int monitor_connected = 0;
	int temp = 2;

	/*
	 * Perform the Read and Write operation.
	 */
	Status = IicLowLevelDynEeprom();
	if (Status != XST_SUCCESS) {
		xil_printf("IIC lowlevel dynamic eeprom Example Failed\r\n");
		return XST_FAILURE;
	}
	xil_printf("Successfully ran IIC lowlevel dynamic eeprom Example\r\n");

	xil_printf("read hdmi HPD is %d\r\n",ReadBuffer[0]);

	while(!monitor_connected)
	{
		if ((ReadBuffer[0] & ADV7511_HPD_CTRL_MASK) == ADV7511_HPD_CTRL_MASK)
		{
			monitor_connected = 1;
		}
		else
		{
			monitor_connected = 0;
		}
		        if(monitor_connected != temp)
		        {
		        	temp = monitor_connected;
		        	if(monitor_connected)
		        	{
		        	    xil_printf("HDMI Monitor connected\r\n");
		        	}
		        	else
		        	{
		        		xil_printf("No HDMI Monitor connected / Monitor Disconnected\r\n");
		        	}
		        	sleep(2); // the program stops here
		        }
	}

thanks

0 Kudos
Reply
3 Replies
florentw
Moderator
Moderator
205 Views
Registered: ‎11-09-2015

HI @jg_spitfire 

How do you know that the application hang on this function? Did you do debug step by step to see what was happening?


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**
jg_spitfire
Adventurer
Adventurer
187 Views
Registered: ‎12-10-2019

below the line of sleep(2) I put a printf and the message is never displayed, also in the debugger I see that the program stops in that function, I just removed the sleep function, the program works without it but it is something strange

0 Kudos
Reply
florentw
Moderator
Moderator
162 Views
Registered: ‎11-09-2015

Hi @jg_spitfire 

There might be a configuration which is missing.

First on Microblaze, you need to have Instruction cache enabled for sleep to work.

Then do you have an AXI Timer in the PL?


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**
0 Kudos
Reply