SPI projects and MAIN #1091
Replies: 6 comments 11 replies
-
Could you post some code? I don't really understand what you did from the description. |
Beta Was this translation helpful? Give feedback.
-
Here ya go... |
Beta Was this translation helpful? Give feedback.
-
As I made that minimal example, and after a full night's sleep, I think the problem is with the lambda functions? Instead, I should be connecting "real" functions. Maybe. |
Beta Was this translation helpful? Give feedback.
-
Try there: Exti::connect<AccInt1>(Exti::Trigger::RisingEdge, [this](auto){
accReady = true;
}); To access class member variables from the lambda you need to capture the |
Beta Was this translation helpful? Give feedback.
-
Is there a reason / MODM coding style convention that signals names are swapped in different modules, for example |
Beta Was this translation helpful? Give feedback.
-
I'm content for now to keep the SPI interface in global. There's no compelling reason to put it in MAIN. But I do have a question about sharing the SPI interface with multiple devices. An earlier reply indicated that this will work. Are there any examples in the examples folder of such sharing? I started testing my Wiznet module yesterday while the BMI088 was still wired into the circuit. I had no reason to run them simultaneously, but I did observe that each device seemed to work by itself. That is, if I initialized one and not the other, things looked normal. I say "looked", because I started noticing weird mistakes as I began exercising the Wiznet module registers more extensively. I would see occasional erroneous stray pulses on the data line which very subtly interfered with the register values I was writing / reading to the Wiznet. I first suspected noise in my unkempt prototype breadboard, and later suspected a timing issues running the SPI at higher speeds. Finally I became suspicious of having both devices on the SPI bus at the same time. While theoretically that should be okay, I had to admit to myself that I didn't really know if I was doing that correctly in MODM. So I pulled out the BMI088 module and POOF -- no more issues. No glitches and all the register transfers with the Wiznet worked exactly as expected. I'm fine now and work is proceeding well. But I would like to know the MODM method of hooking up two SPI devices on the same bus for future applications. |
Beta Was this translation helpful? Give feedback.
-
I'm using the recently added SPI / BMI088 project for STM32H7 as a baseline for my own SPI / Wiznet code.
I tried to put the code into a separate class, and ran into some C++ issues that stump me. The problem happens when I moved things that were in MAIN, specifically the atomic booleans and function calls connecting up the interrupt lambda functions. Seems I can't separate those. For example, if I create them in my new class's initialization function, they're not visible from any other function of the same class.
Can those be extracted from MAIN and put in their own class? Or not?
Beta Was this translation helpful? Give feedback.
All reactions