cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
2,300 Views
Registered: ‎10-16-2017

Microblaze - Sleep not available but required by the AXI IIC Driver

Jump to solution

My problem is that the compilation of hte AXI IIC driver fails because sleep.h (included in the driver file xiic_I.c) is not found. I searched the forums and read that I have to use a timer to get sleep implemented but unfortunately the situation stayed the same, even after I connected a timer, exported the HW and rebuilt the BSP.

Because I could not find any documentation on which timer is required, I tried both: AXI Timebase Watchdog Timer as well as AXI Timer.

What do I have to do to get sleep implemented?

Of course I could just hack the driver but this is not really an option since the hacked BSP would be overwritten everytime somebody generates a new BSP which happens quite frequently.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Moderator
Moderator
2,917 Views
Registered: ‎09-12-2007

Re: Microblaze - Sleep not available but required by the AXI IIC Driver

Jump to solution

What version are you using? There is a sleep function in the Microblaze that was added quite some time ago.

 

In Fact, I just tested there, I created a design in Vivado 2017.4, with I2C. I exported to SDK, and created the BSP.

This compiles without issue.

 

If I open the xiic_l, and F3 on the usleep, I see code:

/*****************************************************************************/
/**
* @brief Provides delay for requested duration.
* @param useconds- time in useconds.
* @return 0
*
* @note Instruction cache should be enabled for this to work.
*
******************************************************************************/
int usleep(unsigned long useconds)
{
sleep_common((u32)useconds, ITERS_PER_USEC);

return 0;
}

View solution in original post

7 Replies
Highlighted
Scholar
Scholar
2,288 Views
Registered: ‎03-22-2016

Re: Microblaze - Sleep not available but required by the AXI IIC Driver

Jump to solution

@obruendl_psi Microblaze does not have a timer so there is no sleep function intrinsically.

Sleep is just waiting for the certain amount of time. Something like this below only that you would do ( Value2-Value1 >= ElapsedTicks ) where ElapsedTicks = TimeIntervalMicroSecs * FREQ_MHZ

https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/tmrctr/examples/xtmrctr_polled_example.c

 

You can implement that with a loop, reading the AXI timer, or setup an interrupt handler that will set a boolean/integer and then wait on this bool/integer to become a certain value. Example:

https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/tmrctr/examples/xtmrctr_intr_64bit_example.c

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Highlighted
Adventurer
Adventurer
2,268 Views
Registered: ‎10-16-2017

Re: Microblaze - Sleep not available but required by the AXI IIC Driver

Jump to solution

I know that I could implement sleep on my own for anything in my application. The problem is that the IIC driver from Xilinx is in the BSP and the BSP is generated. So whenever the BSP is re-generated, any changes I apply to it are overwritten.

 

Therefore I am looking for a way to make the IIC driver working with the BSP generated (without any manual changes to it). If I have to add a timer to make sure sleep is generated in the BSP, that would be okay. Unfortunately I could not find a way to generate a BSP that contains the "sleep" and hence the generated BSP cannot be compiled because the IIC driver expects that "sleep" to be there.

 

 

0 Kudos
Highlighted
Moderator
Moderator
2,918 Views
Registered: ‎09-12-2007

Re: Microblaze - Sleep not available but required by the AXI IIC Driver

Jump to solution

What version are you using? There is a sleep function in the Microblaze that was added quite some time ago.

 

In Fact, I just tested there, I created a design in Vivado 2017.4, with I2C. I exported to SDK, and created the BSP.

This compiles without issue.

 

If I open the xiic_l, and F3 on the usleep, I see code:

/*****************************************************************************/
/**
* @brief Provides delay for requested duration.
* @param useconds- time in useconds.
* @return 0
*
* @note Instruction cache should be enabled for this to work.
*
******************************************************************************/
int usleep(unsigned long useconds)
{
sleep_common((u32)useconds, ITERS_PER_USEC);

return 0;
}

View solution in original post

Highlighted
Adventurer
Adventurer
2,250 Views
Registered: ‎10-16-2017

Re: Microblaze - Sleep not available but required by the AXI IIC Driver

Jump to solution

I am using 2017.2.1

 

I know that there is a microblaze sleep (microblaze_sleep.h/microblaze_sleep.c --> they define the function MB_Sleep()). However, the IIC driver references "<sleep.h>" and expects a function "usleep()", so obfiously this is not the thing I am looking for.

 

I cannot do F3 on the usleep() function since it is not known. I checked all the folders of the BSP and none of them contains "sleep.h", "sleep.c" or "sleep.o". I regenerated the BSP several times but I never thet a sleep. Attached you can find the BSP that SDK generates.

 

In which folder is the Sleep code located in your case?

 

 

0 Kudos
Highlighted
Adventurer
Adventurer
2,205 Views
Registered: ‎10-16-2017

Re: Microblaze - Sleep not available but required by the AXI IIC Driver

Jump to solution

Any update on this? 

 

I already opened an SR about this issue but the support was refused with the note that I should use the forums, so not getting answers here is quite fatal for me since it seems to be the last point where I could get support.

0 Kudos
Highlighted
Moderator
Moderator
2,191 Views
Registered: ‎07-31-2012

Re: Microblaze - Sleep not available but required by the AXI IIC Driver

Jump to solution

Hi @obruendl_psi,

 

In my test case v2017.4, sleep.h is located in ..project_1.sdk\standalone_bsp_0\microblaze_0\libsrc\standalone_v6_5\src and ..\project_1.sdk\standalone_bsp_0\microblaze_0\include locations.

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Highlighted
Adventurer
Adventurer
2,178 Views
Registered: ‎10-16-2017

Re: Microblaze - Sleep not available but required by the AXI IIC Driver

Jump to solution

Hi Praveen,

 

Thank you for the information. Could verify that my BSP is generated correctly in  a newer tool version (I used 2017.3 and not 2017.4 since I already have this installed on a lab-machine).

 

However, upgrading the project to 2017.3 does not work out of the box because of a bug in the upgrade process (Vivado reports 'xilinx.com:ip:blk_mem_gen:8.3' does not support the current part 'xc7a200tfbg676-2', I have already opened an SR).

 

Today I found out that most likely only the error message is misleading (in 2017.4.  the version of blk_mem_gen is 8.4 and not 8.3). So I will try again porting the project using the "write_bd_tcl" flow with the "-no_ip_version" option. I will let you know if this fixes the issue.

 

However, the bug in the project upgrading that is integrated in Vivado should be fixed in future.

 

Best Regards,

 

Oliver

0 Kudos