UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Participant diegosantibanez
Participant
2,365 Views
Registered: ‎07-25-2017

I can't access BRAM from C code.

Jump to solution

I'm trying to Access a BRAM from my PS in a ZCU102.

My Block diagram design is:

 

BD.png

When I export hardware to SDK, apparently everything is configured correctly.

In the linker script, BRAM memory address is correct:

 

 

LinkerScript.png

However, when I try to write or read something in the BRAM addresses, my C code stops. Here is an example:

 

C_code.png

 

(Code stops at *a=1);

 

The same code works perfectly fine when trying to read or write any other memory section such as ocm or  ddr.

It looks like the "PL section" of the design is not working, clocks are not being initialized...or I'm missing something.

 

I tried to uncomment the psu_init.c funtion at init_platform(), but it didn't work.

 

Any idea?

Thank you!

 

Diego.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

C_code.png
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Participant diegosantibanez
Participant
2,906 Views
Registered: ‎07-25-2017

Re: I can't access BRAM from C code.

Jump to solution

Thanks so much for your time! I finally found the problem.

 

It was all about PL initialization.

In Run configuration, all of this boxes were uncheked:

 

Run config.png

 

The PS was active, but when it tried to access the FPGA, it wasn't working.

Now it does :)

 

 

Diego.

View solution in original post

0 Kudos
13 Replies
Scholar hbucher
Scholar
2,345 Views
Registered: ‎03-22-2016

Re: I can't access BRAM from C code.

Jump to solution

@diegosantibanez You have two controllers connecting to one BRAM. It should be just one dual port controller.

 

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
Explorer
Explorer
2,321 Views
Registered: ‎03-31-2016

Re: I can't access BRAM from C code.

Jump to solution

This probably should go in one of the Embedded System topics as it related to Embedded C development than anything Ultrascale specific.

 

But to give an answer,  your addresses don't match.  The linker script uses 0xA0010000 while the C code uses 0xA0000000.  Its been awhile since I used the C development side but I believe the tools give you header files with defines for things like that.

0 Kudos
Participant diegosantibanez
Participant
2,305 Views
Registered: ‎07-25-2017

Re: I can't access BRAM from C code.

Jump to solution

Thanks for the answers, but the problem doesn't look to be any of those. I've tryied a simpler hardware design, and I still have the same problem:

USCALE design.png

 

Same code, but still stopping when trying to read or write an address value.

What am I missing?!

 

Thank you!

0 Kudos
Scholar hbucher
Scholar
2,288 Views
Registered: ‎03-22-2016

Re: I can't access BRAM from C code.

Jump to solution

@diegosantibanez

 

Something must be old/stale on your build.

 

I tested even your first case with two controllers on the same BRAM and it works fine. 

 

 

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
Participant diegosantibanez
Participant
2,280 Views
Registered: ‎07-25-2017

Re: I can't access BRAM from C code.

Jump to solution

Thanks a lot for trying, that gives me great info!

I have some basic questions.

 

1. Did you uncomment psu_init() function inside init_platform()?

2. Did you use the same code as I did?

 

I don't really know what's going on...I'll keep trying things.

 

Thank you!

 

 

0 Kudos
Scholar hbucher
Scholar
2,266 Views
Registered: ‎03-22-2016

Re: I can't access BRAM from C code.

Jump to solution

@diegosantibanez no problem, it is a small project

 

no I did not comment out anything, just a hello world with the pointer assignment as you have

 

why dont you create a new project?  it should take a few minutes.

 

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
Scholar hbucher
Scholar
2,253 Views
Registered: ‎03-22-2016

Re: I can't access BRAM from C code.

Jump to solution

@diegosantibanez

I put the design on github

https://github.com/HFTrader/ZyboExperiments/tree/master/zcu102_bram_test

 

You might need to change the part version - mine is ES2.

 

 

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
Participant diegosantibanez
Participant
2,226 Views
Registered: ‎07-25-2017

Re: I can't access BRAM from C code.

Jump to solution

Thanks again for your time, but unfortunetly I have the same problem using your project. I'm pretty sure that the problem is related to the PL initialization. If I try to run the Project from the SD card, the init_B led is red, which as I read, means that the PL part of the uscale is not working.

 

Besides, I'm not enable to run the psu_init() function nor the psu_init.tcl command, what makes me think that something is not working well. (Those functions are supposed to init clock signals).

 

I've tried to set FSBL_A53_TCM_ECC_EXCLUDE_VAL  to 0 in the FSBL as this article sais:

https://www.xilinx.com/support/answers/67987.html

with bad results.

 

I would love to think that I'm doing somthing wrong, but everything looks to be configured correctly. Any other idea?

 

Thanks a lot for your help guys.

 

Diego.

 

 

 

 

0 Kudos
Scholar hbucher
Scholar
2,212 Views
Registered: ‎03-22-2016

Re: I can't access BRAM from C code.

Jump to solution

@diegosantibanez Make sure the SW6 switch is positioned correctly. 

 

Otherwise run the standard card self-tests BIST. 

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
Participant diegosantibanez
Participant
1,649 Views
Registered: ‎07-25-2017

Re: I can't access BRAM from C code.

Jump to solution

I ran the BIST (https://www.xilinx.com/support/documentation/boards_and_kits/zcu102/xtp426-zcu102-quickstart.pdf). This is what I got:

 

Zcu102 small.jpg

 

The point is that I have 2 different boards and 2 different power supplys, and both of them give the same results.

Those 2 red leds doesn't look too friendly...

 

What am I doing wrong?

 

 

 

 

0 Kudos
Scholar hbucher
Scholar
1,641 Views
Registered: ‎03-22-2016

Re: I can't access BRAM from C code.

Jump to solution

@diegosantibanez Try running the project in Github with all 4 switches down

 

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
Participant diegosantibanez
Participant
1,636 Views
Registered: ‎07-25-2017

Re: I can't access BRAM from C code.

Jump to solution

I did, and it works, but the code stops when trying to write or read BRAM :/

0 Kudos
Highlighted
Participant diegosantibanez
Participant
2,907 Views
Registered: ‎07-25-2017

Re: I can't access BRAM from C code.

Jump to solution

Thanks so much for your time! I finally found the problem.

 

It was all about PL initialization.

In Run configuration, all of this boxes were uncheked:

 

Run config.png

 

The PS was active, but when it tried to access the FPGA, it wasn't working.

Now it does :)

 

 

Diego.

View solution in original post

0 Kudos