Skip to main content
gcntrk
Associate II
December 6, 2013
Question

STM32F4 SPI-DMA error

  • December 6, 2013
  • 4 replies
  • 1274 views
Posted on December 06, 2013 at 14:18

The original post was too long to process during our migration. Please click on the attachment to read the original post.
    This topic has been closed for replies.

    4 replies

    francescatodiego
    Associate III
    December 6, 2013
    Posted on December 06, 2013 at 15:30

    the problem is hard to find only with code reading (....this takes time...for info  you can use the box in the top left of messages editor to format the code. so code  is  more readable)

    Before adding the

    DMA

    check

    the connections

    and

    the configuration of the

    SPI

    tries to

    send data

    by checking the

    TX/RX bits in 

    SR

    register

    When everything is

    OK

    add

    the

    DMA

    437262340
    Visitor II
    December 9, 2013
    Posted on December 09, 2013 at 16:58

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1 ,ENABLE); //使能SPI1时钟

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2 ,ENABLE); //使能SPI2时钟

      and   RCC_APB2Periph_AFIO

    Tesla DeLorean
    Guru
    December 9, 2013
    Posted on December 09, 2013 at 17:32

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1 ,ENABLE); //使能SPI1时钟

     

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2 ,ENABLE); //使能SPI2时钟

     

      and   RCC_APB2Periph_AFIO

    Unless I'm mistaken both clocks are enabled, and this is an F4 example. AFIO is critical in F1 designs where pins are being remapped.
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    gcntrk
    gcntrkAuthor
    Associate II
    December 11, 2013
    Posted on December 11, 2013 at 08:32

    I've solved that problem eventually the problem is I am trying to do unidirectional communication, but in private functions it is not implemented by ''1Line_Tx'' and ''1Line_Rx''. It is implemented by full duplex mode by sender and not assigning input line, and 2Lines_Rx for reciever. ''1Line_Tx'' and ''1Line_Rx'' are used for 1 line bidirectional communication, which involves some other code implementations as I understand. Because it didn't work for my code :) But I have new problem, I get data is shifted, if you wanna help look at the discussion: [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F4%20SPI-DMA%20data%20is%20shifted&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx&currentviews=0]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fSTM32F4%20SPI-DMA%20data%20is%20shifted&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https%3A%2F%2Fmy%2Est%2Ecom%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FAllItems%2Easpx&currentviews=0. Thank you.