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); }