PE not initializing DMA properly

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PE not initializing DMA properly

Jump to solution
1,343 Views
paulderocco
Contributor III

I'm using KDS 1.1.1 with Processor Expert on a FRDM-K64F project. I've set up a couple of DMA channels to talk to UART0, just as I've done before with Codewarrior. The generated code does not initialize the source and destination addresses. I've attached the DMA_Config.h file, which shows in the initial long comment all my settings, but there is no definition for the four DMA_TCD*_*ADDR_VALUE symbols. PE isn't complaining about anything, the code compiles and runs, but of course it doesn't work.

 

Another thing: when I use EmbSys Registers to display the register contents, both before and after calling PE_low_level_init(), it shows random bits in all the registers of all the DMA channels that I'm not using, as well as in the SADDR and DADDR registers of the two that I am using. The chip docs say these registers have undefined reset values, so I would think some generated could would be responsible for clearing them all to something reasonable first. Not sure how this worked in Codewarrior, but it certainly did work.

Original Attachment has been moved to: DMA_Config.h.txt.zip

1 Solution
964 Views
marek_neuzil
NXP Employee
NXP Employee

Hello Paul,

The hot fix have been updated, see the attached file.

The usage of experssions for Addresses is described in the help of the component. The casting must be used to avoid warning of the used compiler. These warnings also depends on the selected compiler and settings of the compiler. Therefore you should always cast the expression (uint32_t) that is used as the address to avoid any warnings.

Best Regards,

Marek Neuzil

View solution in original post

8 Replies
959 Views
paulderocco
Contributor III

Just checked Codewarrior. It leaves unused channels uninitialized, too, because it doesn't matter what's in them until they're enabled. So the bug in the KDS version of Processor Expert is that the SADDR and DADDR values aren't placed into the DMA_Config.h file. The workaround, I suppose, is to initialize these in the application, but that also requires not starting the DMA channel until after this has taken place.

Does anyone know if the relation between the entries in the Processor Expert panels and the code that's generated is described by some XML file that can be hacked in order to fix this?

And is there a more official place for reporting PE bugs, rather than just casually mentioning them here?

0 Kudos
Reply
959 Views
marek_neuzil
NXP Employee
NXP Employee

Hello Paul,

This issue has been already reported (Init_eDMA does not initialize several SADDRx and DADDRx registers for K64 derivatives). We have already a hot fix for this bug. See the attached hot fix package in the attachment.

Best Regards,

Marek Neuzil

(attached hot fix has been removed due to unfixed related problem)

0 Kudos
Reply
964 Views
paulderocco
Contributor III

That only fixes half of the bug. That ensures that DMA_Init.c tests the DMA_TCDn_SADDR_VALUE and DMA_TCDn_DADDR_VALUE symbols for all TCDs, not just TCD0 to TCD3. But there is still the problem that when Processor Expert generates my DMA_Config.h file, it doesn't generate DMA_TCDn_SADDR_VALUE and DMA_TCDn_DADDR_VALUE symbols in the first place. Take a closer look at the file I attached, above.

0 Kudos
Reply
964 Views
marek_neuzil
NXP Employee
NXP Employee

Hello Paul,

I have analysed the problem and I have reported the issue of the Init_eDMA component to development team. They will provide update of the hot fix.

Best Regards,

Marek Neuzil

0 Kudos
Reply
964 Views
paulderocco
Contributor III

I just noticed another minor thing about this which is different from the Codewarrior version of the component. The code doesn't supply a cast to a uint32_t. In the old component, I could supply the name of an array as the source or destination, and it would precede it with (uint32_t). Now I have to do it myself.

The strange thing is I only get the error when I use an array name. I don't get the error when I use something like &UART0_D, even though that also attempts to store a byte pointer into an unsigned word. Go figure...

0 Kudos
Reply
965 Views
marek_neuzil
NXP Employee
NXP Employee

Hello Paul,

The hot fix have been updated, see the attached file.

The usage of experssions for Addresses is described in the help of the component. The casting must be used to avoid warning of the used compiler. These warnings also depends on the selected compiler and settings of the compiler. Therefore you should always cast the expression (uint32_t) that is used as the address to avoid any warnings.

Best Regards,

Marek Neuzil

964 Views
paulderocco
Contributor III

That looks like it fixed the bug. I've since made other changes to my project, including not using DMA any more, so I can't actually run a test, but I see where DMA_Config.h now has #defines for all the channels' sources and destinations, not just channels 0...3. Thanks.

0 Kudos
Reply
964 Views
BlackNight
NXP Employee
NXP Employee

the official place would be Processor Expert Software

0 Kudos
Reply