Author Topic: SAI CMSIS  (Read 1335 times)

0 Members and 1 Guest are viewing this topic.

Online ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
SAI CMSIS
« on: April 05, 2017, 08:14:35 am »
Hi
This is my first hands on the SAI interface, here is my code
Code: [Select]
extern ARM_DRIVER_SAI Driver_SAI0;
ARM_DRIVER_SAI *SAI_drv=&Driver_SAI0;


void mySAI_callback(uint32_t event)
{
int x=0;
switch (event)
{
case ARM_SAI_EVENT_SEND_COMPLETE:
        /* Success: Wakeup Thread */
        x=0;
__breakpoint(0);
        break;

case ARM_SAI_EVENT_TX_UNDERFLOW:
        /* Success: Wakeup Thread */
        //__breakpoint(0);
x=1;
        break;

case ARM_SAI_EVENT_RECEIVE_COMPLETE:
        /* Success: Wakeup Thread */
        //__breakpoint(0);
x=2;
        break;

case ARM_SAI_EVENT_FRAME_ERROR:
        /* Success: Wakeup Thread */
        //__breakpoint(0);
x=3;
        break;

case ARM_SAI_EVENT_RX_OVERFLOW:
        /* Success: Wakeup Thread */
        //__breakpoint(0);
x=4;
        break;

}

SAI_drv->Send(wave_data,64);
}


void main (void)
{
SAI_drv->Initialize(mySAI_callback);
SAI_drv->PowerControl(ARM_POWER_FULL);
// configure Transmitter to Asynchronous Master: I2S Protocol, 16-bit data, 16kHz Audio frequency
SAI_drv->Control(ARM_SAI_CONFIGURE_TX |
                             ARM_SAI_MODE_MASTER  |
                             ARM_SAI_ASYNCHRONOUS |
                             ARM_SAI_PROTOCOL_I2S |
                             ARM_SAI_DATA_SIZE(16), 0, 16000);

// enable Transmitter
SAI_drv->Control(ARM_SAI_CONTROL_TX, 1, 0);
SAI_drv->Send(wave_data,64);
while(1)
{
}
}

the problem is that after calling SAI_drv->Control(ARM_SAI_CONTROL_TX, 1, 0); the callback would get called with the ARM_SAI_EVENT_TX_UNDERFLOW,  no matter how I do the things, I wanted to know do you have any idea what's going on wrong? the callback would not be called any more for continuous data transfer
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: SAI CMSIS
« Reply #1 on: April 07, 2017, 06:07:03 am »
You mean like this: https://www.keil.com/pack/doc/CMSIS/Driver/html/group__sai__interface__gr.html ?
Wasn't most the CMSIS 2.x Driver middleware stuff deprecated in CMSIS 3.x (and we're now up to v4)?  AFAIK, few of the chip vendors actually implemented the middleware layers - After all, their proprietary peripheral implementations were their big product differentiators, and I don't think they liked having their "superior" implementations reduced to a common abstraction...

In any case, to have a hope of debugging/helping with this, we need to know which chip you are using!
 

Online ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Re: SAI CMSIS
« Reply #2 on: April 11, 2017, 01:47:37 pm »
Yes I mean using that, the actual chip I'm using is LPC4337 from  NXP.
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf