2023-11-09 10:41 AM
Hi guys,
I'm currently working on a project where I need to use the SPI protocol.
After setting everything up in the .ioc file and generating the code. I wanted to check if the clock signal was properly working. So i hooked up my ossciloscop to the clk pin. To my surprise there was nog clk signal being generated.
I've attached a few pictures of the ioc view asswel as the code.
Could you guys help me out on this one?
Kind regards Erik
Solved! Go to Solution.
2023-11-09 12:15 PM
Incrementing from 23 to the integer limit. Probably getting a Hard Fault and not getting to the HAL_SPI_Transmit() at all.
Hint: not i++
2023-11-09 10:52 AM
2023-11-09 11:03 AM
You'll need to be Transmitting something to get clocks.
It would be more helpful to show the code configuring the SPI, peripherals, pins, clocks, and the code transmitting, perhaps a 0x55 pattern, in a continuous loop.
2023-11-09 11:27 AM
These are the files with the code, i'm trying to build the same project as Controllerstech in this video:
2023-11-09 11:40 AM
The for loop in this function doesn't look too good...
void ws2812_spi (int GREEN, int RED, int BLUE) { uint32_t color = GREEN<<16 | RED <<8 | BLUE; uint8_t sendData[24]; int indx = 0; for (int i=23; i>=0; i++) { if(((color>>i)&0x01) == 1) sendData[indx++] = 0b110; else sendData[indx++] = 0b100; } HAL_SPI_Transmit(&hspi1, sendData, 24, 1000); }
2023-11-09 12:15 PM
Incrementing from 23 to the integer limit. Probably getting a Hard Fault and not getting to the HAL_SPI_Transmit() at all.
Hint: not i++