Hello,
I want to control the ad9833 module with the stm32f4 development board. I have a library but I couldn't get SPI communication. I cannot get any wave output from the module. I cannot adjust frequency. where can the problem be? I need to create this project with CUBEMX and do the work using the Keil development environment. I am using the SPI1 module of the board. I use PA5 pin as SCK, PA7 pin as MOSI and PB2 pin as GPIO reset. Below is the code part that i tried to spi communication.
void ad9833_send(uint16_t dat) { unsigned char i; HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_SET); //clk = 1 for(i=0; i<16; i++) { if (dat & 0x8000) { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_SET); } else { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_RESET); } HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET); dat <<= 1; __NOP(); __NOP(); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET); } //HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET); }
BYHLM said:ad9833
You mean this: https://www.analog.com/en/products/ad9833.html ?
BYHLM said:I couldn't get SPI communication
Clearly, that is absolutely fundamental: the AD9833 is an SPI device - so you won't be able to do anything before you've got SPI working.
Getting the STM32 SPI to work is nothing to do with Keil or ARM - you need to study the ST datasheet, User Manual, Application Notes, Examples, etc for that.
https://www.st.com/en/microcontrollers-microprocessors/stm32f4-series.html
Lots of training resources available from ST:
community.arm.com/.../109675
For support with ST specifics, you need to go to ST:
https://community.st.com/s/
See:
community.arm.com/.../158950