2022-01-12 02:28 AM
Things that have tried.
Kindly requesting to sent the procedure or sample code to sent 24 bit of data through STM32 SPI
2022-01-12 05:46 AM
Send 8 bits of data 3 times in succession. That will give you 24 bits of data. On some families, you can send 24 bits in a single operation.
If you want super tight timing of the CS line, you can make your own SPI driver. HAL has a lot of overhead. You can also compile on higher optimization levels. But CS being low for longer poses no problems for communication.
Include your chip number in your post.
2022-01-12 06:45 AM
What STM32?
And what system clock? It seems to me that even with Cube/HAL, 20us-60us between setting GPIO and any other action is too much.
As TDK said, get rid of Cube and switch on optimization.
JW
2022-01-12 09:32 PM
Hi All,
Really thanks for your quick response ,please find the inline answers.
>>Include your chip number in your post.
STM32F746IGTx
LQFP176
The SPI interface chip is ADAR 1000.
https://www.analog.com/en/products/adar1000.html
>> And what system clock?
Internal 16 Mhz clock , attached screen shot for the clock configuration.
So with my understanding from the above reply .
>> If the answer is yes , any example is available for reference ?
Lastly apology , if I am asking silly question as I am new to STM32 Microcontroller.
Regards,
Rs
2022-01-12 09:33 PM
2022-01-12 09:50 PM
Sending 3 8-bit bytes adds up to 24 bits. There is no functional difference between a single 24-bit write and 3x8-bit writes.
The F7 has a 32-bit TXFIFO which can buffer the 3 bytes immediately without having to wait for data to be shifted out.
You can use DMA if you want, but it's not necessary.
2022-01-12 11:19 PM
Hi ,
Please find the inline answers.
>>Sending 3 8-bit bytes adds up to 24 bits. There is no functional difference between a single 24-bit write and 3x8-bit writes.
When sending 3 8 bits, the chip select is asserted for two times ( attached screen shot ) , so my peripheral chip is assuming a different SPI cycle during the assertion of each chip select. That is the problem, I am facing
2022-01-13 07:39 AM
Looks like you're using NSSP mode.
Manage CS as a GPIO output and toggle it manually.
2022-01-13 09:46 PM
Hi ,
Thanks for the answer. Please find the inline answers.
>>Looks like you're using NSSP mode.
Yes , the screenshot provided is in NSSP mode.
>>Manage CS as a GPIO output and toggle it manually.
Yes , I have tried to toggle manually . But the issue is that the CS to assert is taking long time. Attached the screen shot for reference .
Any idea how to reduce the assertion time ?
The code I was using given below.
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1,(uint8_t *) &EEPROM_WRDI , 1, 100);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);
Really glad for your help.
2022-01-14 06:15 AM
> Any idea how to reduce the assertion time ?
Use your own code driver instead of HAL, or increase optimization level and/or clock frequency.
If you want the convenience of HAL, you live with its drawbacks.