-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling using macports arm-none-eabi-gcc v9.2.0_1 #1
Comments
I'm glad this stuff was useful for you! Thanks for the information about the MacOS build. I'll try building with your change on Linux and if it works, I'll just remove Finally, I'm interested in your DMA problem on Zephyr. I've only done limited unserious experimentation with Zephyr so far, so I can't answer your question. My usual approach to debugging this sort of thing is very very low-tech: run in the debugger, stop just before you trigger the DMA, print out the contents of every single register that might make a difference (DMA setup, peripheral setup, RCC stuff, interrupt setup) and sit down with the MCU reference manual and a cup of coffee and convince yourself that every bit is right. It's shockingly easy to misconfigure something, and it only takes one flag being wrong to mess things up. If that doesn't lead you to the answer, I'd find a working example, do the same "dump all the registers" thing right before a DMA is triggered and compare with what you've got. (I'm well aware that that sounds incredibly amateurish. I find debugging these things very hard, and the only way I've ever been able to do it is to get as much visibility into how the MCU is configured as possible. There's usually something that jumps out.) My suspicion in this case would be that there is something getting set up by a Zephyr driver or part of the Zephyr BSP somewhere, and the state of the MCU doesn't correspond exactly to what you think it does. |
Hi Ian! Thanks for getting back to me. I was worried my board was bad, but compiling your code made me realize something is messed up on my side for sure. I was fighting with this all week, and a friend was helping a bit (when they have time) so I have been printing out registers and verify them (not amateurish at all, just convenient!). Since all I am doing at the moment is to get it to even transfer data, here is the code of what I have (if you care, haha), As a heads up All the GPIO pins are enabled, as I am using the GPIO driver from Zephyr, but I was able to get your
With the output over the serial port given,
I am at a loss, as no one seems to have this issue, after days of googling. So I suspect it may be some permission issue with how zephyr is storing ram, and access to it, because otherwise I may need to look for another alternative. PS. I used to do micros 10+ years ago, and things have clearly changed since then, haha. All the abstraction layers and libraries, so much more to debug. PPS. I am also no expert in Zephyr, I just jumped in, haha. As I have a grad school experiment I am working on that needs a device to be isolated but measure off the ADC and store to an SD card. I naively thought the ADC modules supported continuous mode, but that is something they are working on. Ideally, having a cheap repairable/replaceable part is the priority, as it could get damaged easily, hence this direction. |
Hey Ian, So it was to do with the DCACHE, I posted this problem in Zephyr as well, but my friend had some time to help me tonight and found the solution was to use |
Ouch. I didn't know about that at all. I guess I just got lucky. I've been reading around a bit, and this comment seems to be about the clearest description of how to make DMA work properly with the data cache enabled (it's a general comment about doing DMA in the presence of caching and it makes total sense). I've also seen some stuff about DMA with some peripherals (in particular ETH) not working properly when the DCACHE is disabled, so it might be worth learning how to manage the cache invalidation properly anyway. |
Yeah, seems like a common problem with many projects, such as ChibiOS and NuttX as well. I suppose it isn't common on many micros. Yeah I was a bit confused because I saw some that you enable DCache and ICache in |
@ddkn Do you think you could try building the latest version of this? I've removed the reference to As for this DCACHE + DMA thing, I think I need to investigate that properly when I have time. I have another STM32 project where I'm using DMA to transmit data to a USART and I've not seen any problems, despite having the caches enabled and being totally slapdash about them! It's this thing (which is totally stalled at the moment, but I might get back to it later in the spring), and the relevant code that sets off a DMA transfer is here. I don't flush the data cache before that, but I've never noticed any problems with the data sent over the USART (it's USART3 on the F767 Nucleo board, which goes to the ST-Link virtual COM port for debugging, so I can see pretty easily if things get screwed up). |
Hello,
Thanks for the tutorial!
I was testing out the project and compiling using macports arm-none-eabi does not generate *.out files. In the Makefile the nano.specs seemed to be the offender. As the linker complained about not being able to find -lc_nano.
This solved my problem.
Another issue was using an outdated GNU make. gmake v3.81 did not like the #define, where v4.3 worked as expected. FYI, I am on MacOS High Sierra. Otherwise I had to copy the contents of the define do-link into the
build/%out: build/%.o
section.I was following your example trying to learn to use the DMA on top of Zephyr (avoiding their DMA+ADC drivers as custom options are needed for an ADC project. I could could get the DMA to initiate interrupts, but no data was ever copied from the peripheral to memory, as in your ex2.c.
I tried to simplify life by troubleshooting and just did straight memory to memory, but again, I see successful transmission interrupts occurring, but no data is ever copied from
DMA2_Stream0->PAR
toDMA2_Stream0->M0AR
, whether it is a variable, array etc... Even if I initialize the destination array, it never changes, even though there was data in the source array or in ADC1->DR. Have you ever seen a situation where that occurs?PS, thanks again for the nice tutorial!
The text was updated successfully, but these errors were encountered: