cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
davirol
Observer
Observer
3,299 Views
Registered: ‎08-16-2017

Problems with petalinux and baremetal app which uses DMA

 

Hi all,

 

We are working with ZC702 FPGA platform. We have petalinux running in CPU0 whereas a baremetal application is running in CPU1. This baremetal application works with DMA (not CDMA).

 

When we use the baremetal application alone everything works fine: DMA and interrupts are working. However, when using petalinux for CPU0 and baremetal for CPU1 (via openAMP library, remote_proc) we are having some issues, because DMA is not working, data is not being copied to DDR and we are having errors.

 

Anyone knows what can be happening? There's anyhting we have to configure when using petalinux along with a baremetal application which utilizes DMA? Is petalinux taking control over DMA and this is the cause our application is not running properly?

 

Any help will be appreciated. Thanks.

 

Regards,

David

0 Kudos
Reply
7 Replies
jovitac
Moderator
Moderator
3,249 Views
Registered: ‎05-10-2017

David,

 

Which version of petalinux are you using and what are the errors you are seeing?

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Reply
davirol
Observer
Observer
3,229 Views
Registered: ‎08-16-2017

Hi @jovitac, thank you for your response. We are using Petalinux 2016.3.

 

It seems DMA is not reading, our buffer is initializated to known values, but data is not being updated in DDR because its values never change. However, if we executed this code standalone (without petalinux) everything works fine.

0 Kudos
Reply
davirol
Observer
Observer
3,222 Views
Registered: ‎08-16-2017

Hi again,

 

We caught an interrupt from DMA in the SGDMA_interrupt_handler function, and it give us an IRQ_ERROR....this is the content of the registers:

Dump registers 40400030:
Control REG: 64017012
Status REG: 00010219
Cur BD REG: 00000000
Tail BD REG: 00128300

Thanks, regards,

David

0 Kudos
Reply
jovitac
Moderator
Moderator
3,204 Views
Registered: ‎05-10-2017

Could you please attach your device-tree? Do the demo apps work?

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Reply
davirol
Observer
Observer
3,156 Views
Registered: ‎08-16-2017

Hi @jovitac, I attached the device-tree. Yes, the demo apps work.

 

Thank you again,

David

0 Kudos
Reply
jovitac
Moderator
Moderator
2,958 Views
Registered: ‎05-10-2017

Make sure your kernel base address is set to higher address  0x10000000

Set memory split to 2G/2G

Enable high memory support.

 

Please see Chapter 3, Setting up Petalinux with OpenAMP.

 

Hope this helps

 

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Reply
davirol
Observer
Observer
2,918 Views
Registered: ‎08-16-2017

Thanks @jovitac, we have everything configured like you suggest us. But we still have the DMA problem. We have tried to add in the device tree a node to shared memory between linux and baremetal, in the following way:

 

	reserved-memory {
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;

		/* global autoconfigured region for contiguous allocations */
		linux,cma@3F000000{
			compatible = "shared-dma-pool";
			reusable;
			size = <0x4000000>;
			alignment = <0x2000>;
			linux,cma-default;
		};
       }

Maybe the problem is that shared memory between both cores must be configured as DMA compatible or something related to this issue.

 

Any clues?

 

Thank you in adcance,

David

0 Kudos
Reply