2014-11-02 02:38 AM
Hello,
I'm using an STM32F4 discovery board and I'm trying to control the DDS waveform generator chip AD9833 with it. I'm not very experienced with ARM. I have a AD9833 module like in the picture:http://www.ebay.com/itm/like/281440408871Datasheet of AD9833:http://www.analog.com/static/imported-files/data_sheets/AD9833.pdfNow, I happen to find a program that runs with Arduino, I've tested it and got no problem. I wanted to change that code so it is compatible with STM32F4. I used SPI tutorials and managed to get a successful compile but I do not see the desired signals on the oscilloscope. I used the PA5 and PA7 as the SPI pins for SCK and MOSI and PE3 for the FSYNC. Could you please help with this issue, I really appreciate it. I've put both the Arduino and my code on the zip file which can be downloaded:https://drive.google.com/file/d/0B30BBdr7Hh3MZUlidG9JMmZrQzA/view?usp=sharingThank so much for the help! #stm32f4 #discovery #spi2014-11-02 05:01 AM
Probably want to be checking TXE/RXNE instead of blindly writing
/**
* @brief Write a byte on the SD.
* @param Data: byte to send.
* @retval None
*/
uint8_t SD_WriteByte(uint8_t Data)
{
/*!< Wait until the transmit buffer is empty */
while(SPI_I2S_GetFlagStatus(SD_SPI, SPI_I2S_FLAG_TXE) == RESET)
{
}
/*!< Send the byte */
SPI_I2S_SendData(SD_SPI, Data);
/*!< Wait to receive a byte*/
while(SPI_I2S_GetFlagStatus(SD_SPI, SPI_I2S_FLAG_RXNE) == RESET)
{
}
/*!< Return the byte read from the SPI bus */
return SPI_I2S_ReceiveData(SD_SPI);
}
2014-11-03 08:34 AM
Thanks for the help clive1. I have some questions though, if I'm not going to receive anything would i still have to use
while(SPI_I2S_GetFlagStatus(SD_SPI, SPI_I2S_FLAG_RXNE) == RESET)
{
}
/*!< Return the byte read from the SPI bus */
return SPI_I2S_ReceiveData(SD_SPI);
part? Also how can i send the high part and low part of a 16 bit word in this method? Thanks.
2014-11-03 10:08 AM
It's important to understand the symmetrical nature of the SPI interface, TXE signals as soon as, and probably before, the first bit hits the wire, whereas RXNE signals after the last bit has left. This is important with respect to manually driving as CS pin.
Do you have the interface in 16-bit mode? In which case the SPI->DR will be 16-bit wide. If in 8-bit mode you'll need to mask/shift the appropriate bits to match the byte endianess required by the devices.2014-11-23 04:51 AM
Hello, I've been working on the project for a while now. I'm now able to generate the desired waveform but I can not set the frequency or the phase of the signal. Can you tell what am i doing wrong and how can it be fixed? Thank you very much!
https://drive.google.com/file/d/0B30BBdr7Hh3MaEhud0FLZS02TUU/view?usp=sharing2016-09-28 10:05 PM
Hi,
I am using AD9833(DDS) waveform generator.Interfacing stm32 microcontroller and AD9833 Via SPI.--My Question is ,How to generate waveform using AD9833 Chip.--In AD9833 chip Frequency sweep is available.If available ,how to do frequency frequency sweep for every step of 1Hz.I am very new to this please help me how to do this..Thank you.