eTPU Quad Encoder Init malloc error

Discussion to talk about software related topics only.
Post Reply
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

eTPU Quad Encoder Init malloc error

Post by barttech »

I'm clawing my way through getting a QD running to monitor a DC motor. When I call
fs_etpu_qd_init(...
I get a return value of 1, ie //#define FS_ETPU_ERROR_MALLOC 1
If I then try to call
fs_etpu_qd_enable(..
it hangs or traps.

I have the following includes:
#include <basictypes.h>
#include <etpu_util.h>
#include <etpu_qd.h>
#include <etpuInit.h>
#include <NNDK_etpu_set.h>
#include "Encoder.h"

I'm having trouble following the app notes on whether I have to include some other set or make my own set for QD. All I need is QD and GPIO, it compiles fine, it acts the same whether I have #include <NNDK_etpu_set.h> or not.
I don't know how to track down the malloc error, I know it means a problem getting memory, but I don't know what to do in this case. I'm assuming I need some more or different includes. I know some of you have gotten QD to work.
Any help?
Sam
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: eTPU Quad Encoder Init malloc error

Post by v8dave »

Have you built a custom eTPU for your Netburner module as the standard one that comes with the dev kit does not have Quadrature in there. All the function calls are in the code, but the actual microcode for the eTPU is not.

Dave...
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

Re: eTPU Quad Encoder Init malloc error

Post by barttech »

Is that true if I can use Predefined Function Set 3, set3.h? The NB AppNote says I just have to change ETPUInit and recompile. Do I need the code from Freescale as well? The AppNote tells how to make custom sets if the predefined won't supply what I need, but set 3 does.

Which brings me to my next problem; the AppNote says "To switch between sets you must change the included set file in ETPUinit.cpp. After the
set header file is changed then the MOD5234 system directory must be recompiled to reflect the changes. " When I do the change and click "Rebuild All System Files" (should I just rebuild the modified ones? Should I somehow restrict the rebuild to just the MOD5234 directory?) I get the following errors showing in the console:

m68k-elf-gcc -m5200 -MM bsp.c dbg34mon.c gdb5234.c cfc_mem_nburn.c ETPU/functions_API/etpu_acimvc.c ETPU/functions_API/etpu_acimvhz.c ETPU/functions_API/etpu_asac.c ETPU/functions_API/etpu_asdc.c ETPU/functions_API/etpu_bc.c ETPU/functions_API/etpu_cc.c ETPU/functions_API/etpu_fpm.c ETPU/functions_API/etpu_gpio.c ETPU/functions_API/etpu_util.c ETPU/functions_API/etpu_gpio.c ETPU/functions_API/etpu_hd.c ETPU/functions_API/etpu_ic.c ETPU/functions_API/etpu_oc.c ETPU/functions_API/etpu_pmsmvc.c ETPU/functions_API/etpu_ppa.c ETPU/functions_API/etpu_pwm.c ETPU/functions_API/etpu_pwmmac.c ETPU/functions_API/etpu_pwmmdc.c ETPU/functions_API/etpu_qd.c ETPU/functions_API/etpu_qom.c ETPU/functions_API/etpu_sc.c ETPU/functions_API/etpu_sm.c ETPU/functions_API/etpu_spi.c ETPU/functions_API/etpu_test.c ETPU/functions_API/etpu_uart.c ETPU/functions_API/etpu_uart_fc.c ETPU/functions_API/etpu_util.c -I"G:\nburn\include" -I"G:\nburn\MOD5234\include" -I"G:\nburn\MOD5234\include\ETPU" -I"G:\nburn\MOD5234\include\ETPU\cpu" -I"G:\nburn\MOD5234\include\ETPU\sets" -I"G:\nburn\MOD5234\include\ETPU\functions_API" -DMOD5234 -DMCF5234 >>MOD5234depend.mk
0 [main] sh 1444 sync_with_child: child 6732(0x190) died before initialization with status code 0x0
<snip>
m68k-elf-gcc -c -m5206e -gdwarf-2 -Wall -D_DEBUG -falign-functions=4 -DMOD5234 -DMCF5234 -DNBMINGW -I"G:\nburn\include" -I"G:\nburn\MOD5234\include" -I"G:\nburn\MOD5234\include\ETPU" -I"G:\nburn\MOD5234\include\ETPU\cpu" -I"G:\nburn\MOD5234\include\ETPU\sets" -I"G:\nburn\MOD5234\include\ETPU\functions_API" ETPU/functions_API/etpu_util.c -o ETPU/functions_API/etpu_util.od
ETPU/functions_API/etpu_util.c: In function 'fs_etpu_init':
ETPU/functions_API/etpu_util.c:91: error: for each function it appears in.)

rm ETPU/functions_API/etpu_cc.od dbg34mon.od cfc_mem_nburn.od ETPU/functions_API/etpu_fpm.od gdb5234.od ETPU/functions_API/etpu_asdc.od ETPU/functions_API/etpu_acimvc.od ETPU/functions_API/etpu_acimvhz.od bsp.od ETPU/functions_API/etpu_gpio.od ETPU/functions_API/etpu_asac.od ETPU/functions_API/etpu_bc.od

After this, my system won't compile, the *.a files in MOD5234\lib are still there but many are much shorter than the originals. So whether or not I need code from Freescale, I can't rebuild it into my system. I haven't tried the DOS approach outlined in the FAQ since I suspect I've got a path problem, but I don't know what it is.

The line pointed to in the second error looks like this:
if ( x >4 ) return (FS_ETPU_ERROR_VIS_BIT_NOT_SET);

Help?
Sam
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: eTPU Quad Encoder Init malloc error

Post by v8dave »

Hi Sam,

I think someone from Netburner will need to help here. What you did should be enough to include the set you need. In fact, I use this method as the original test before I went to the Freescale website to build my own set. I needed UART, PWM, QD and SPI and none of the supplied sets had this so I had to make my own from the website.

If you reset back the original NNDK_etpu_set.h file does it rebuild the system files?

Another quick question. Do you have your project open and selected in the tree? I have found that the REBUILD or BUILD system files won't work unless I have a project open and selected. I get this error if not selected

An internal error occurred during: "Clean and rebuild system files".
java.lang.NullPointerException

Dave...
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

Re: eTPU Quad Encoder Init malloc error

Post by barttech »

Thanks Dave,
Your comment was helpful, I didn't think I had to do a custom set just to get QD.
I do have my project selected. I tried returning to the original files and still got the same errors. Then I tried re-installing NBEclipse, and got a new raft of trouble, see http://forum.embeddedethernet.com/viewt ... &sk=t&sd=a

Time to submit a ticket ...
Sam
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

Re: eTPU Quad Encoder Init malloc error

Post by barttech »

Ugh, I didn't have eTPUInit() in before I called fs_etpu_qd_init(), I think i thought fs_etpu_qd_init() did all the initing, but not so!
Sam
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

Re: eTPU Quad Encoder Init malloc error

Post by barttech »

And the
0 [main] sh 1444 sync_with_child: child 6732(0x190) died before initialization with status code 0x0
error seems to be a conflict between msys and Vista 64, Forrest sent me a newer version of msys which seems to have solved that problem.
Sam
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

Re: eTPU Quad Encoder Init malloc error

Post by barttech »

The etpu_qd_auto.h file that came with the NB setup (Rel24_rc2) had some problems, NB is providing updated files to correct this. This fixed my etpu_set3.h problem, still seems to be a problem with set4, could be me, but now I've got a working encoder!!
Sam
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: eTPU Quad Encoder Init malloc error

Post by v8dave »

Hi Sam,

As I created my own custom set, I had copied over the supplied .h files from Freescale so it was working. If you do your own set from the Freescale website, I think you need to make sure you copy the header files to the cpu directory. My freescale supplied header files had different values compared to the one in the standard supplied files so was the reason I changed them out.

I am wondering if this is the reason that the set3 would not work because they would have been for the standard set? There seems to be some kind of index values and these were what was different with my set.

I added all the peripherals I thought I would likely need for future designs just to be sure so that I would not need to make changes again.

Good to hear you got it working though.

Dave...
Post Reply