CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

MMC/SD drivers and examples doesn't work (?)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Brusque



Joined: 16 Dec 2008
Posts: 1
Location: Blumenau, SC, Brazil

View user's profile Send private message Visit poster's website MSN Messenger

MMC/SD drivers and examples doesn't work (?)
PostPosted: Tue Dec 16, 2008 11:58 am     Reply with quote

Hello,

I have extensive experience with PCM and PCH. Now I'm using PCD v4.083, with MPLAB v8.15a and the Microchip's ICD3 along with CCS' own DSP Analog Board, with a dsPIC33FJ128GP706, MMC/SD card connector and TLV320 ADC/DAC.

I've typed and run without major problems the examples from EX1 to
EX11 of the DSP Analog Exercise Book but there's no way to make EX12.C to work.

I also tried to run ex_mmcsd.c, but mmcsd_init() always returns 0x80 or 0xFE. I've checked with a digital oscilloscope and the pins are working correctly.

I could sucessfully use the "SD/MMC Card File System" for C30 compiler, from Brush Electronics (http://www.brushelectronics.com/index.php?page=software) so I can assure the hardware is working correctly.

I've tried compiling it for debug and for release, with the same
results. I've also tried several cards (128MB, 1GB, 2GB) formated with
FAT16 and FAT32.

I know (from own and other's experience) that CCS compiler isn't very stable but it's hard to believe that CCS' code doesn't work with their own hardware.

Someone could sucesfully make the mmcsd.c driver to work with PIC24/dsPICs?

I've sent email to CCS support yesterday and still haven't received any answer from them.

Thank you very much,

Brusque
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Fri Feb 27, 2009 11:00 am     Reply with quote

Hello Brusque,

take a look on this topic:

http://www.ccsinfo.com/forum/viewtopic.php?t=37463&highlight=mmc


regards.
_________________
Andre
KeithA



Joined: 09 Mar 2009
Posts: 4

View user's profile Send private message

A little help with the TLV320AIC23B codec on dsPIC dev board
PostPosted: Mon Mar 09, 2009 7:59 pm     Reply with quote

Hello everyone,
I just recently purchased the Analog dsPic development board "dsPIC33FJ128GP706" in order to get more familiar with them. I've been trying the exercises shown in the book in the effort to test out the board but I've had a few non-working exercises. This one in particular is suppose to generate a tone internally and output it to the TLV320AIC23B codec. I typed in the code example word-for-word as shown in the book and all I get when connecting a set of headphones to any of the outputs is white noise. Here's the code for this particular exercise:
Code:

#include <33fj128gp706.h>
#fuses HS, NOWDT, NOCOE, NODEBUG, PR
#use delay(clock=12000000)
#use rs232(baud=9600, UART2)

#include <math.h>
//#include <flex_lcd.c>
#include <TLV320AIC23B.c>

//#define LCD_DATA_PORT

#define PCM_TABLE_SIZE 256
#define MAXIMUM_VAL 32768

unsigned int8 pcm_pos;
signed int16 pcm_table[PCM_TABLE_SIZE];
const float INCREMENT = ((2*PI)/PCM_TABLE_SIZE);

signed int16 leftChannel = 0x0000;
signed int16 rightChannel = 0x0000;

unsigned int8 sample_resolution = 16; // 1 to 16
signed int32 sample_step;
signed int32 base;
signed int32 multiplier;
int8 down_sample_period = 1;

#define RED_LED      PIN_C2
#define YELLOW_LED   PIN_G9
#define GREEN_LED    PIN_C14

#define BUTTON_1     PIN_B2
#define BUTTON_2     PIN_B3
#define BUTTON_3     PIN_B4
#define BUTTON_4     PIN_B5

void main()
{
   unsigned int8 i;
   
   setup_adc_ports(NO_ANALOGS);
   setup_adc_ports2(NO_ANALOGS);
   
   pcm_pos = 0;
   
   sample_step = 1;
   for(i = 0; i < sample_resolution - 1; i++)
   {
      sample_step *= 2;
   }
   
   base = MAXIMUM_VAL / sample_step;
   
   delay_ms(600);
   
   /* Start up the dci peripheral */
   setup_dci((MULTICHANNEL_MODE | MULTI_DEVICE_BUS | UNDERFLOW_LAST |
   DCI_SLAVE | DCI_CLOCK_INPUT | SAMPLE_RISING_EDGE),
   DCI_1WORD_FRAME | DCI_16BIT_WORD | DCI_2WORD_INTERRUPT,
   RECEIVE_SLOT0 | RECEIVE_SLOT1,
   TRANSMIT_SLOT0 | TRANSMIT_SLOT1, 0);
   
   /* Initialize the codec */
   codec_initialize();
   codec_setup_analog_path(DAC_SELECT | ADC_MIC_INPUT);
   
   dci_start();
   /* Generate since wave PCM table */
   for(i = 0; i < 255; i++)
   {
      pcm_table[i] = 127 * sin(INCREMENT * i) + 128;
   }
   //make sure to init i = 255
   pcm_table[i] = 127 * sin(INCREMENT * i) + 128;
   
   setup_timer1(TMR_INTERNAL | TMR_DIV_BY_8, 10);
   setup_timer2(TMR_INTERNAL | TMR_DIV_BY_64, 0x4000);
   enable_interrupts(INT_TIMER1);
   enable_interrupts(INT_TIMER2);
   enable_interrupts(INTR_GLOBAL);
   
      while(TRUE)
   {
      codec_write_data16(&leftChannel, &rightChannel);
   }
   
//   lcd_init();  // Always call this first.
//   lcd_putc("\fHello World\n");
//   lcd_putc("Line Number 2");
//   output_high(GREEN_LED);

}

#int_timer1
void timer1_isr()
{
   /* Choose the next waveform value */
   pcm_pos = (pcm_pos + 1) % PCM_TABLE_SIZE;
   
   /* Generate and format the value */
   leftChannel = pcm_table[pcm_pos];
   
   multiplier = leftChannel / base;
   leftChannel = base * multiplier;
   rightChannel = leftChannel;
}

#int_timer2
void timer2_isr()
{
   int8 i;
   
   if(!input(BUTTON_4))
   {
      output_toggle(GREEN_LED);
     
      if(sample_resolution > 1)
      {
         sample_resolution--;
      }
     
      sample_step = 1;
      for(i = 0; i < sample_resolution -1; i++)
      {
         sample_step *= 2;
      }
     
      base = MAXIMUM_VAL / sample_step;
     
      return;
   }
   
   if(!input(BUTTON_3))
   {
      output_toggle(YELLOW_LED);
     
      if(sample_resolution < 16)
      {
         sample_resolution++;
      }
     
      sample_step = 1;
      for(i = 0; i < sample_resolution - 1; i++)
      {
         sample_step *= 2;
      }
     
      base = MAXIMUM_VAL / sample_step;
     
      return;
   }
}

I would really appreciate any help that anyone could give.
Thank you in advance,
Keith
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

RE:
PostPosted: Tue Mar 10, 2009 12:04 am     Reply with quote

I don't think CCS compiler is unstable, I have been able to configure a FAT file system using CCS.

Most problems occur due to the different varieties of memory cards available, ensure you are using the correct commands for the card.

thanks
arunb
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group