AnsweredAssumed Answered

SPI with DMA can not send data properly ?

Question asked by H.Rick on Oct 2, 2015
Guys,

I tried to send data via SPI and DMA but can not get a proper data sent...
I can't see CS up and down as well.....
code:
void Mp3WriteRegister(unsigned char addressbyte, unsigned char highbyte, unsigned char lowbyte)
{
         
    Mp3DeselectData();
    Mp3SelectControl();             //XCS = 0
    uint8_t data6[4] = { 0x02, addressbyte, highbyte, lowbyte };
    //uint8_t data6[4] = { VS_WRITE_COMMAND, addressbyte, highbyte, lowbyte };
    HAL_SPI_Transmit_DMA(&hspi1,data6,4);  
    /*
    SPIPutChar(VS_WRITE_COMMAND);   //????????
    SPIPutChar(addressbyte);        //????????
    SPIPutChar(highbyte);           //????????8?
    SPIPutChar(lowbyte);            //????????8?
    */
    Mp3DeselectControl();
}
 
Mp3WriteRegister(0x03,0xC0,0x00);
......................
/*
XCS = PA4
XDCS = PE8
XRESET = PE9
DREQ = PE7
XCS = NSS
*/
 /**SPI1 GPIO Configuration   
    PA4     ------> SPI1_NSS
    PA5     ------> SPI1_SCK
    PA6     ------> SPI1_MISO
    PA7     ------> SPI1_MOSI
 
#define Mp3SelectControl()      { GPIOA->ODR &= ~MP3_XCS; }
  
#define Mp3DeselectControl()    { GPIOA->ODR |= MP3_XCS; }
  
 
#define MP3_XDCS                ( 1 << 8 )
 
 
#define Mp3SelectData()         { GPIOE->ODR &= ~MP3_XDCS; }
 
#define Mp3DeselectData()       { GPIOE->ODR |= MP3_XDCS; }
logic%20analyzer%20VS1053%203.jpg

Outcomes