Shutdown / Disable an Interface? #1107
Replies: 5 comments 2 replies
-
Here's the error message, which I can almost understand after I spent some time reformatting it in an editor. Well, I can understand what it's saying, but not exactly how it matches the function I added.
|
Beta Was this translation helpful? Give feedback.
-
And last but not least, here is the function in question, whose format I copied from the [HPP (inside the class)
[_IMPL_HPP]
And here's where I try to call it, in the same class where I do other SPI operations, like transfer, in the
|
Beta Was this translation helpful? Give feedback.
-
Just one hour after posting this, I figured out a workaround ( yet to be tested ). In the main boot loader code, when I need to jump, instead of jumping, I'll put a message in RAM containing the desired jump address. Then I'll issue an NVIC System Reset, thus putting all the peripherals in their default state. In my boot loader code start up code, I'll check for such a valid message before I initialize all the peripherals. If a jump address message is found, I'll jump. That may not be a perfect solution, because in MODM some things are "configured" just by their existence. I'm not entirely clear but I think things like the interrupts and any DMA setup happens when you connect something in your app startup code. In the case of this problematic SPI / Ethernet case, that's easy. For the UART, which isn't causing problems but theoretically should also probably be disabled (not enabled) as well, that's more tricky since it's done in my custom MODM BSP code -- tricky but not impossible. Well, on further thought, this is going to be non-trivial to implement. I'm instantiating my devices in global space because of memory issues. I guess I can instantiate a memory-message-checking class before all other devices. That class would rudely jump to the application program if warranted, instead of returning. But regardless, I'd like to know how to disable things in the code after they've been initialized, if such a procedure exists. |
Beta Was this translation helpful? Give feedback.
-
Okay -- I found out why my that function addition I had made to the SPI class wasn't recognized. It isn't being processed by LBUILD. Unlike other directories in the main MODM directory tree, like say PLATFORM/UART/STM32 or DRIVER/ETHERNET, any changes I make in PLATFORM/SPI/STM32 are simply ignored. I confirmed this on two different machines. Interestingly it's clearly fetching the SPI code from somewhere. I can completely delete the local MODM directory, and it gets recreated with the original files before I started editing them SOLVED... The separate STM32H7 directory for the SPI peripheral escaped my attention. DOH |
Beta Was this translation helpful? Give feedback.
-
I'm going to close this discussion as "wrapped up". I was able to disable the things which I wanted to, and I see how to add a shutdown function in the future. Unfortunately, I was not able to accomplish my ultimate goal, which was to fix a problem with the application when it is jumped-to from the boot loader. I figured out exactly what instruction "kills" things, but there was no obvious reason at first glance. I'm pressing forward with Plan B using RAM memory messages, something I need to do anyway for other reasons. I will revisit this problem in a later issue once the overall project wraps up and I have some time to better trace it. |
Beta Was this translation helpful? Give feedback.
-
What's the technique to completely disable a peripheral interface in MODM?
I tried to make such a function for the SPI master DMA that is controlling my Wiznet chip. But I'm unable to succeed in a successful compile. Before I go deeper down that path, I'm curious if there's an existing mechanism that has escaped me so far.
I'm asking because that exact DMA channel I'm using is also being used by the application that my boot loader jumps to. Even though I disable MCU interrupts before jumping, it seems the DMA engine interrupt generator is still enabled. So that somehow kills the application which hasn't yet setup its IRQ and an unexpected interrupt from the DMA engine drives it into a hard fault.
Beta Was this translation helpful? Give feedback.
All reactions