This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Accessing CPLD Registers through DM368

Other Parts Discussed in Thread: TMS320DM368

Hi, I have a DM368 EVM and I'm attempting to write/read the CPLD registers. 

So far, I followed the DVSDK_4.02 4_02_00_06 download procedure, created a virtual Ubuntu image, downloaded the Code Sourcery GCC toolchain and installed it and finally, downloaded and installed the dvsdk_dm368-evm_4_02_00_06_setuplinux.  I've gone through most of the TMS320DM368 Software Developers Guide, created a simple "hello world" app and managed to execute it down on the target.  Now I'm wanting to write some code to access the CPLD registers.

I found some sample code here: http://support.spectrumdigital.com/boards/evmdm368/revg/ for testing the various peripherals.  I believe this test code was compiled under Code Composer Studio, which I haven't installed. 

I can see that there is a GEL file which appears tp initialize the memory map for the DM368.  The file evmdm368.c has the eventual function call to the CPLD register in question with the following line:

*cpld_addrmap_lower[regnum] = regval;

where the following array of cpld addresses is also defined near the top of the file:

static Uint8 *cpld_addrmap_lower[CPLD_NUMREGS_LOWER] =

{

 (Uint8 *)0x04000000, // Register 0

 (Uint8 *)0x04000008, // Register 1

 (Uint8 *)0x04000010, // Register 2

 (Uint8 *)0x04000018, // Register 3

 (Uint8 *)0x04000400, // Register 4

 (Uint8 *)0x04000408, // Register 5

 (Uint8 *)0x04000410, // Register 6

 (Uint8 *)0x04000418, // Register 7

 (Uint8 *)0x04000800, // Register 8

 (Uint8 *)0x04000808, // Register 9

 (Uint8 *)0x04000810, // Register 10

 (Uint8 *)0x04000818, // Register 11

 (Uint8 *)0x04000c00, // Register 12

 (Uint8 *)0x04000c08, // Register 13

 (Uint8 *)0x04000c10, // Register 14

 (Uint8 *)0x04000c18, // Register 15

 (Uint8 *)0x04001000, // Register 16

 (Uint8 *)0x04001008, // Register 17

 (Uint8 *)0x04001010, // Register 18

 (Uint8 *)0x04001018, // Register 19

 (Uint8 *)0x04001400, // Register 20

};

Since I'm not able to use the GEL file without Code Composer Studio, how can I initialize the memory map for the DM368 so that when one of the above addressess is dereferenced, it writes/reads the appropriate CPLD register?  I believe there is a mapping or remapping that needs to occur in order to make that happen.

Insights into which functions to call would be greatly appreciated.

I've been compiling my code using arm-none-linux-gnueabi-gcc

Thanks

Derek

  • I managed to locate a piece of code that seems to accomplish what I was wanting to do...

    In the directory ti-dvsdk_dm368-evm_4_02_00_06/example-applications/am-sysinfo-1.0/mem_util, there is a file called mem_util.c.  The executable is in my target file system in the folder targetfs/usr/bin. 

    When I run mem_util with the following arguments for example: mem_util 0x04000010 b 0xBC, the leds on the board are toggled to the pattern 0xBC, as the leds live at register 2 in the CPLD register mapping, which is address 0x04000010 from the host. 

    It looks like the function call to mmap in mem_util.c accomplishes the remapping of the address in question.

    Well, now I suppose I'll see if I can port the code into my own application...

    Cheers

    Derek