Interrupt receiving through SPI MISO line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-28 9:53 AM - last edited on ‎2025-01-28 3:31 PM by Pavel A.
Hi. I'm developing a custom STM32 circuit board.
I'm trying to use an analog-front-end, AD7124-8 ADC chip.
However, this chip generates an interrupt signal through the MISO pin when data is ready.
As you know, once we set SPI in STM32, we cannot use GPIO interrupt callback.
I know somebody already asked about this issue but I want to know if any document solves this problem clearly.
- Labels:
-
STM32WB series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-28 12:59 PM
My microcontroller is STM32WB09TEF7TR.
I thought that it is quite a general method that uses MISO as interrupt input because the company is selling chips.
The only problem is that I don't know the detail method.
If there is any hint, I would appreciate it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-28 1:02 PM
How did you know that my microcontroller,
Yes, I'm using STM32WB09TEF7TR.
I'll read the manual and try to fix code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-28 1:04 PM
Thanks for your reply.
I'll study interrupt-driven SPI and try to modify the code.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-28 2:49 PM - edited ‎2025-01-28 2:50 PM
I tried to set the MISO pin as the GPIO Interrupt pin in the MX_GPIO_Init().
---------------
GPIO_InitStruct.Pin = GPIO_PIN_8; // -> this is actual interrpt pin using MISO pin
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
------------------
However, once I put the code, the microcontroller is halted even before starting MX_GPIO_Init().
I cannot understand why it happened because this halt happened before calling these two functions, MX_GPIO_Init() and MX_SPI_Init().
One thing I need to say is that I run the GPIO and SPI initialization code after receiving the command through the Bluetooth LE.
Really situation is hard to understand.
In addition, this is a Bluetooth device. So, I cannot run debug mode....holy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-28 3:34 PM
Sorry. I gave up. :(
I'll use a timer-interrupted SPI. :(
:(
STM32 is wasting my time a lot.
They should learn how Espressif does.
CubeMX is the source of evil because it generates code that we need to modify :(, which means that we have to understand STM32 itself even though we are not an STM employee.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 12:39 AM
@KKIM.6 wrote:I thought that it is quite a general method that uses MISO as interrupt input because the company is selling chips.
No, it's quite unusual.
The company doing this is the maker of the ADC - not the maker of the microcontroller.
They are abusing the standard use of SPI.
Perhaps go to their forum, and ask them how they suggest handling this?
@KKIM.6 wrote:The only problem is that I don't know the detail method.
So do you not have colleagues/supervisors/teachers to help you?
@TDK has said that a single STM32 pin can operate as both an EXTI interrupt input and MISO at the same time.
So, effectively the same as I showed here, but internally within the STM32 on a single pin:
STM32 ------------------+ | EXTI<---+ | | | ___ MISO<---+----+------- DOUT/RDY | ------------------+
The only problem with that is to stop the SPI communication from causing EXTI interrupts.
So you'll need something like:
- With EXTI enabled, you wait for the DRDY interrupt
- When you get a DRDY interrupt, disable further interrupts
- Do the SPI transfer
- Re-enable the DRDY interrupt
- now we're back at 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 12:46 AM
@KKIM.6 wrote:CubeMX is the source of evil because it generates code that we need to modify .
Clearly, an automated tool cannot cope with every weird corner-case - it has to address the common use cases.
Yours is a wierd corner-case.
@KKIM.6 wrote:we have to understand STM32 itself
That is true of any microcontroller - and, in fact, any other electronic device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 8:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 8:44 AM - edited ‎2025-01-29 9:01 AM
In the case of Espressif, when we write the main() function and build the project, all the necessary components start being set up from that point. Unlike CubeMX, which requires structuring everything beforehand, Espressif’s approach significantly reduces the chances of errors.
Moreover, in modern development, we rely heavily on AI tools like ChatGPT or Gemini. However, explaining CubeMX in text form to ChatGPT is quite challenging. Additionally, when trying to transfer the built code to AI, it’s nearly impossible to upload dozens of pages of code in full.
This essentially means that the CubeMX system is already outdated.
You will understand this once you use Espressif.
With Espressif, you can simply ask ChatGPT to write Wi-Fi code, structure threads within the main() function, and then hit build—at which point, all necessary components are automatically configured.
This level of convenience is something STM should learn from.
In addition, why CubeIDE doesn't have a built-in Terminal? Espressif IDE uses the same Eclipse system, but it has a built-in terminal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 9:26 AM
@KKIM.6 wrote:In addition, why CubeIDE doesn't have a built-in Terminal?
Pretty sure it does.
But I prefer an external terminal anyhow - so have never bothered with it.

- « Previous
- Next »