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.

cc2540

Other Parts Discussed in Thread: CC2540

Dear Ti,

bought the mini kit + usb keyfob doungle and ccDebughgger CC2540 from The Mouser Electronics January 14, 2013 because We plan to develop a project to acquire an ECG.

Now my question is can you see a sinusoidal wave  acquired with keyfob at a sampling rate of 1000 samples per second you can suggest me how to do.

Thank you and best regards.

  • Hi Giancarlo,

    This will depend on the frequency and offset+amplitude of the sinusoidal wave. 

    For code, I suggest you look at hal_adc.c in the example projects.

    This must be changed, perhaps drastically. If you want 1000 samples per second exactly, I suggest that you have a look at the CC254x User's Guide, and then

    1. Set up the ADC and the input signal so that it's correctly measured (Chapter 12)
    2. Set up timer 1 to generate a compare event every milisecond (Chapter 9)
    3. Set up a DMA channel to transfer each time a sample is finished (Chapter 8)
    4. Set up a DMA Isr to switch DMA buffers on complete and re-arm DMA.

    Or you can just call the adc function in hal_adc really really often.

    Some example usages of DMA can be found in the UART/SPI drivers.

    Best regards,
    Aslak

  • Maybe your answer is correct, but I still have not mastered this device.

    I would be grateful if you indicated to me an example to follow.

    for now I have changed keyfob.c

    I used the channel  P0_1 as input

    This is was I do

    // For the CC2540DK-MINI keyfob, device doesn't start advertising until button is pressed

        uint8 initial_advertising_enable = TRUE;   // read Continuously

     

     

    P0SEL = 0; // Configure Port 0 as GPIO

      P1SEL = 0x40; // Configure Port 1 as GPIO, except P1.6 for peripheral function for buzzer

      P2SEL = 0; // Configure Port 2 as GPIO

     

      P0DIR = 0xFC; // Port 0 pins P0.0 and P0.1 as input (buttons),

                    // all others (P0.2-P0.7) as output

      P1DIR = 0xFF; // All port 1 pins (P1.0-P1.7) as output

      P2DIR = 0x1F; // All port 1 pins (P2.0-P2.4) as output

     

      P0 = 0x03; // All pins on port 0 to low except for P0.0 and P0.1 (buttons)

      P1 = 0;   // All pins on port 1 to low

      P2 = 0;   // All pins on port 2 to low

     

      APCFG=0x03;     // AIN0 e AiN1 input

    I used after reading through the accelerometer to see through the Btool

    new_adcCh0 = HalAdcRead( HAL_ADC_CHANNEL_0, HAL_ADC_RESOLUTION_10 );

    x = new_adcCh0;

    Accel_SetParameter(ACCEL_X_ATTR, sizeof ( int8 ), &x);

    the result is not as I expected because I have given every 10 ms for 10 values

    then a pause of 900 ms.

    I apologize but I am a beginner

    best reagrds

     

  • Hi,

    I understand. Unfortunately we don't have an existing example for just what you need.

    Embedded programming can be a bit difficult, but I have no better suggestion than just trying to do one thing at a time and learn how to use the debugger to set breakpoints(F9), view variable values (View->watch) and register values (view->register).

    Best regards,
    Aslak