Sign in

username:

password:



Not a member?

Search c54x



Search tips

Subscribe to c54x



c54x by Keywords

5409 | 5416 | AD5 | ADC | BIOS | Boot | Booting | Bootloader | C540 | C5402 | C5409 | C5416 | CCS | Codec | DMA | Dmad | DSK | DSKPlus | Dsplib | EVM | FFT | FIR | Flash | GPIO | HPI | Initialization | Interrupt | JTAG | LOG_printf | MCBSP | RFFT | RTDX | Sampling | STLM | UART | VC540

Ads

Discussion Groups

Discussion Groups | TMS320C54x | McBSP as GPIO

Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).

  

Post a new Thread

McBSP as GPIO - mahmood molaei - Mar 13 6:22:29 2008



Dear Group people 
I am going to use three pins of Mcbsp and I read Volume 5: Enhanced Peripherals
document(section 2.9) and I wrote this program .
#include "tonecfg.h"
#include "dsk5416.h"
#include "dsk5416_pcm3002.h"
#include  "csl_mcbsp.h"
#include <math.h>
#include "csl_gpio.h"
#include "csl_hpihal.h"
#include "csl_gpio.h"
#include "tonecfg.h"

void delay(void)
{
long i, j=0;
for(i=0;i<DELAY;i++){
j++;
}

}
while(1)
    {
     MCBSP_RSETH(hMcbsp0, SPCR1 ,0x0000);
     MCBSP_RSETH(hMcbsp0, SPCR2,0x0000);
    MCBSP_RSETH(hMcbsp0, PCR,0x2a0a);
    delay();
      MCBSP_RSET(PCR0, 0x2a00);
    MCBSP_RSETH(hMcbsp0, PCR,0x2a00);
  delay();
   }
void main()
{
// Initialize the board support library
DSK5416_init();
} 

Also I configured McBSP on CSL as GPIO port . 
the program is built without any error.
I connected an LED to DC_BCLKX0 on DSK5416 but it didn't work.
Do you know what   wrong is with  it. 

would you please help me.
 
Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution
for Commercial & Consumer End Equipment: www.ti.com/dm6467



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: McBSP as GPIO - Jeff Brower - Mar 13 8:46:03 2008

Mahmood-

Your code is kinda messed up.  You have code outside of main() that will never run,
because processing after Reset starts from main().  Here is some pseudo code, try to
understand this:

  void main() {  /* code starts here after Reset */

    DSK5416_init();  /* init board */
    init CSL         /* init CSL (if needed) */

    while (1) {  /* forever loop, do not exit main */

      toggle GPIO pin  /* connected to LED &/

      very long delay  /* > 1/4 sec to make toggle clearly visible */
    }
  }

Also, when you say "I connected an LED to DC_BCLKX0" bit, it sounds to me like you
connected an LED directly and are expecting it to work.  You need something like
this:

                  O 3.3V
                  |
                  /
                  \ 330 ohm
                  /
                 _|_
                _\_/_  LED
                  |
   DC_BCLKX0 -----+

In this case, when DC_BCLKX0 is low, the LED will turn on.  You need to be careful
not to put too much current through the DSP's GPIO pins.  In the above case, the
current is about 10 mA -- you should check the 5416 data sheet and make sure that's
within the spec for the chip's GPIO pins.

-Jeff

mahmood molaei wrote:
> 
> Dear Group people
> I am going to use three pins of Mcbsp and I read Volume 5: Enhanced Peripherals
> document(section 2.9) and I wrote this program .
> #include "tonecfg.h"
> #include "dsk5416.h"
> #include "dsk5416_pcm3002.h"
> #include  "csl_mcbsp.h"
> #include <math.h>
> #include "csl_gpio.h"
> #include "csl_hpihal.h"
> #include "csl_gpio.h"
> #include "tonecfg.h"
> 
> void delay(void)
> {
> long i, j=0;
> for(i=0;i<DELAY;i++){
> j++;
> }
> 
> }
> while(1)
>     {
>      MCBSP_RSETH(hMcbsp0, SPCR1 ,0x0000);
>      MCBSP_RSETH(hMcbsp0, SPCR2,0x0000);
>     MCBSP_RSETH(hMcbsp0, PCR,0x2a0a);
>     delay();
>       MCBSP_RSET(PCR0, 0x2a00);
>     MCBSP_RSETH(hMcbsp0, PCR,0x2a00);
>   delay();
>    }
> void main()
> {
> // Initialize the board support library
> DSK5416_init();
> 
> }
> 
> Also I configured McBSP on CSL as GPIO port .
> the program is built without any error.
> I connected an LED to DC_BCLKX0 on DSK5416 but it didn't work.
> Do you know what   wrong is with  it.
Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution
for Commercial & Consumer End Equipment: www.ti.com/dm6467



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: McBSP as GPIO - Jeff Brower - Mar 15 12:02:27 2008

Mahmood-
> Thank you very much for your kindly help
> it worked

Ok glad to hear that!  Keep going.

Please post to the group (not to me) so other students doing similar projects can see
your results.  Now that you are getting your DSP programs to run, other students may
want to ask you questions :-)

-Jeff
> Jeff Brower <j...@signalogic.com> wrote:
>
>       Mahmood-
>
>      Your code is kinda messed up. You have code outside of main() that will
>      never run,
>      because processing after Reset starts from main(). Here is some pseudo
>      code, try to
>      understand this:
>
>        void main() { /* code starts here after Reset */
>
>          DSK5416_init();    /* init board */
>          init CSL           /* init CSL (if needed) */
>
>          while (1) {        /* forever loop, do not exit main */
>
>            toggle GPIO pin  /* connected to LED &/
>
>            very long delay  /* > 1/4 sec to make toggle clearly visible */
>          }
>        }
>
>      Also, when you say "I connected an LED to DC_BCLKX0" bit, it sounds to me
>      like you
>      connected an LED directly and are expecting it to work. You need
>      something like
>      this:
>
>                     O 3.3V
>                     |
>                     /
>                     \ 330 ohm
>                     /
>                    _|_
>                   _\_/_ LED
>                     |
>      DC_BCLKX0 -----+
>
>      In this case, when DC_BCLKX0 is low, the LED will turn on. You need to be
>      careful
>      not to put too much current through the DSP's GPIO pins. In the above
>      case, the
>      current is about 10 mA -- you should check the 5416 data sheet and make
>      sure that's
>      within the spec for the chip's GPIO pins.
>
>      -Jeff
>
>      mahmood molaei wrote:
>      >
>      > Dear Group people
>      > I am going to use three pins of Mcbsp and I read Volume 5: Enhanced
>      Peripherals
>      > document(section 2.9) and I wrote this program .
>      > #include "tonecfg.h"
>      > #include "dsk5416.h"
>      > #include "dsk5416_pcm3002.h"
>      > #include "csl_mcbsp.h"
>      > #include
>      > #include "csl_gpio.h"
>      > #include "csl_hpihal.h"
>      > #include "csl_gpio.h"
>      > #include "tonecfg.h"
>      >
>      > void delay(void)
>      > {
>      > long i, j=0;
>      > for(i=0;i
>      > j++;
>      > }
>      >
>      > }
>      > while(1)
>      > {
>      > MCBSP_RSETH(hMcbsp0, SPCR1 ,0x0000);
>      > MCBSP_RSETH(hMcbsp0, SPCR2,0x0000);
>      > MCBSP_RSETH(hMcbsp0, PCR,0x2a0a);
>      > delay();
>      > MCBSP_RSET(PCR0, 0x2a00);
>      > MCBSP_RSETH(hMcbsp0, PCR,0x2a00);
>      > delay();
>      > }
>      > void main()
>      > {
>      > // Initialize the board support library
>      > DSK5416_init();
>      >
>      > }
>      >
>      > Also I configured McBSP on CSL as GPIO port .
>      > the program is built without any error.
>      > I connected an LED to DC_BCLKX0 on DSK5416 but it didn't work.
>      > Do you know what wrong is with it.
>
> ------------------------------------------------------------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )