2013-12-06 05:18 AM
2013-12-06 06:30 AM
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 inSR
register
When everything is
OK
add
the
DMA
2013-12-09 07:58 AM
2013-12-09 08:32 AM
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.
2013-12-10 11:32 PM
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¤tviews=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¤tviews=0. Thank you.