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.

Trying to blink an user led from CCS studio.v5.3

Other Parts Discussed in Thread: AM3359

Hi,

Iam trying to blink an LED by modifying in the corresponding parameters like pinmux and GPIO registers in GEL file. The following are the registers i modified. i put the led_blink function in OnTargetConnect().

#define CONF_GPMC_A5 (CONTROL_BASE_ADDR + 0x814)
#define CONF_GPMC_A6 (CONTROL_BASE_ADDR + 0x818)
#define CONF_GPMC_A7 (CONTROL_BASE_ADDR + 0x81C)
#define CONF_GPMC_A8 (CONTROL_BASE_ADDR + 0x820)

#define GPIO1 (0x4804C000)
#define GPIO_CTRL (GPIO1 + 0x130)
#define GPIO_OE (GPIO1 + 0x134)
#define GPIO_SETDATAOUT (GPIO1 + 0x194)
#define GPIO_CLEARDATAOUT (GPIO1 + 0x190)

Led_blink()
{

UWORD32 buf, *buf1,*buf2,*buf3,*buf4, i, j, k;

WR_MEM_32(CONF_GPMC_A5, 0x00000077);
WR_MEM_32(CONF_GPMC_A6, 0x00000077);
WR_MEM_32(CONF_GPMC_A7, 0x00000077);
WR_MEM_32(CONF_GPMC_A8, 0x00000077);
WR_MEM_32(GPIO_CTRL, 0x3);
WR_MEM_32(GPIO_OE, 0xFE1FFFFF);
GEL_TextOut("**** writing to the led .......... \n","Output",1,1,1);
while(1) {

WR_MEM_32(GPIO_SETDATAOUT, 0x1E000000);
GEL_TextOut("****ON*****\n","Output",1,1,1);
for(k=0;k<10;k++)
{
for(j=0;j<10000;j++);
}
WR_MEM_32(GPIO_CLEARDATAOUT, 0x1E000000);
k=0;
j=0;
GEL_TextOut("****OFF*****\n","Output",1,1,1);
}
}

    

  • Iam getting the following error while writing in to the GPIO memory,

    CortxA8: Trouble Writing Memory Block at 0x4804c130 on Page 0 of Length 0x4: (Error -1065 @ 0x3D5A) Unable to access device memory. Verify that the memory address is in valid memory. If error persists, confirm configuration, power-cycle board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 5.0.872.0)
    CortxA8: GEL: Error while executing OnTargetConnect(): target access failed at *((unsigned int *) (0x4804C000+0x130))=(unsigned int) 0x3 [BeagleBlack_400Mhz_DDR.gel:273] at Led_blink() [BeagleBlack_400Mhz_DDR.gel:349] at OnTargetConnect() .
    IcePick_D_0: Error: (Error -150 @ 0xFFFFFF6A) One of the FTDI driver functions used during configuration returned a invalid status or an error. (Emulation package 5.0.872.0)
  • Can anybody please reply ? iam using beaglebone black AM3359 and JTAG emulator XDS100v2 in linux environment.
  • Hi,

    I suspect you are running the LED_blink() before the other calls inside the existing OnTargetConnect() of the beagleboneblack.gel, is that so? If so, you may have better chances to get this running by adding your blink function after the call to AM335x_BeagleBlack_Initialization();

    Despite this, unless you have a very specific requirement I would rather create a complete project in CCS as this allows complete debugging of your code - the New Project function allows creating an AM3359 project really easily.

    --Cheers
  • Hi,

    Actually first i tried to create a project for this, but there is no header files or predefined register address , functions included in that project and if i defined it in project it was giving error. After that i have gone to gel file and tried the same. I installed the CCS v6 in linux, is there any dependencies with that..? if there please suggest and suggest me for the project creation also.
  • Hi,

    I see. All the registers you need for the blinky are already defined in your GEL script snippet, therefore it is just a matter of copying this to a plain AM3359 project.

    Similar to the microcontrollers, a complete set of registers and macros for these are usually available on packages such as Starterware (old) or Processors SDK (new) - they have blinky examples as well. However, these processors are more complex and therefore these examples tend to favor the use of libraries instead of direct register access. In some ways the libraries are better (interact with the TI-RTOS, for example) or worse (increase the code complexity). You can try to use one of the code examples and judge what is the best approach to be taken.

    --Cheers