-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
F103RE variant problems #719
Comments
I think the RE variant is not complete, or is not error free. |
I have compiled for RC and RE board successfully on older versions of the core (used one of those to write the very first version of the stm32f1 marlin HAL and ran fine). It's possible that something broke since then. The easiest way would be to hook up a debugger and see exactly where it's crashing. |
Thanks for the comments. At some point, I'll use a debugger to find where it hangs. |
Have you tried the RC MCU option to see if that works or not? |
Any update? |
Not yet, taking this week off, need a quiet break. Got it jotted down for Monday 12/30. |
OK, I didn't wait until Monday. I'm compiling on Ubunut 16.04 using arduino-builder command line (taken from arduino 1.8.10 verbose output). Compiling with -fqbn=Arduino_STM32:STM32F1:genericSTM32F103R:device_variant=STM32F103RE,upload_method=STLinkMethod,cpu_speed=speed_72mhz,opt=osstd in start_c.c, function start_c, line 84, the call to __libc_init_array never returns. variant STM32F103RB returns from __libc_init_array just fine. So I'll investigate more. |
That's some progress, I believe that takes care on initializing memory for object instances. Most likely failing to initialize a peripheral that's different betweenthe RB andRE versions. Can you try the same using RC or RD as MCU (RD possibly not available as an option, but RC I believe should be). I remember at least the DMA peripheral is different, and the UARTs, SPI, I2S, and a few more if I remember right are different too. |
BTW if you have one of those super cheap ST-Link clones, it can be turned into a j-link, and then use Ozone to debug which is awesome. |
Not at my desk at the moment...
I'll see if the RC variant hangs in the same spot.
No serial in blink sketch, just I/O. I'll check the build output, I think
there's a -DSERIAL_USB flag or something like that.
Thanks for replying.
…On Thu, Dec 26, 2019, 4:11 PM victorpv ***@***.***> wrote:
That's some progress, I believe that takes care on initializing memory for
object instances. Most likely failing to initialize a peripheral that's
different betweenthe RB andRE versions. Can you try the same using RC or RD
as MCU (RD possibly not available as an option, but RC I believe should
be). I remember at least the DMA peripheral is different, and the UARTs,
SPI, I2S, and a few more if I remember right are different too.
Do you have anything other thank blinking in the sketch, such as opening a
serial port or anything else?
I remember now I used an STM32F103RET6 to write the I2S driver a couple of
years ago, and adapted an MP3 player to run on it too, so back then
everything was working fine. I should have some boards with that MCU, will
try to blink a led if I have a moment. I would have to download the latest
core.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#719?email_source=notifications&email_token=AAH2EHSN4ZLDHDCLO2JEU2DQ2U22NA5CNFSM4JR6GQT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHWIEIA#issuecomment-569147936>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH2EHT7BBJ3AKZVULADZHTQ2U22NANCNFSM4JR6GQTQ>
.
|
OK RC variant, hangs on __libc_init_array(). Here's the build output for start_s.c and syscalls.c ( -DSERIAL_USB is a GCC define, don't know if that helps or not).
Now, after it hangs on __libc_init_array, st-link can't find the MCU anymore.
I have to unlock the MCU with I did find this link https://community.arm.com/developer/ip-products/processors/f/cortex-m-forum/11187/memory-related-issue-with-mcu-startup-__libc_init_array About half way down, there's a couple comments. Here's my attempts at workaround. -falign-functions=4 doesn't fix this problem. As for the optimization, I haven't figured out how arduino-builder sets the optimization level yet. |
Seems like you are having a hard fault. I did confirm I wrote the i2s and sdio drivers for that core on STM32F103RET6 boards. From the date of the folder in arduino/hardware, it was a version from around 04/02/2018 or earlier. I likely modified multiple other things in that core to use a 16Mhz crystal since that's what I used in the bluepill F4 boards I fitted with F103RET MCUs. I'm downloading the current repo and will try to recompile one of those projects with it. One more thing, what optimization level did you use? O0, O2, O3, LTO or not LTO? One more thing, I remember dealing with hard crashes a long time ago similar to what you get. I ended up running thru the initialization with ozone one function at a time, and it was crashing when initializing an SPI port instance. That was back when I was doing changes to the SPI library to support DMA or improve the DMA functions a bit more. That's why I suspect yours is crashing on the creator of an instance of some peripheral. Anyway if I can get something to crash in the new place with the new core, I may be able to help. |
Ok, this was fast. I downloaded the current core, zip file from github, uncompressed, and changed my SDIO project to use that core.
At this point I can't reproduce the problem even with a more complex sketch, so I think you should try downloading the core again just in case there was a bug in the version you have in your hard drive. Didn't try blinking a led, but I can't imagine it would get this far and fail to blink a led. |
OK, sounds good. I'll change the optimization and see what happens. Thanks for spending the time on this, I appreciate it. |
Remember to download the core again, since I tested with the version from today and you opened the issue last month, so perhaps something got fixed in between. |
Sure, I cloned the repo this afternoon. I'll work a little more this evening, first trying the -O3 change. |
No luck with RE with any optimization. blink.ino
I'm compiling using linux IDE 1.8.10 only, all libraries and boards are up to date (no command line compiles anymore). Tried both cloned and zip download of Arduino_STM32 this evening. Using STLINK/v2 cheap clone for programmer. RB compiles and runs with all optimizations. RE compiles and does not run with any optimization. I'm going to try these same steps on Windows 10 now. |
Some of the core and the libraries will only work OK if you use the default optimisation of -OS AFIK -Os is basically -O2 except for things which would make the code bigger. I think the core will work OK with -O3 but not all the libraries work OK with that level of optimisation. IMHO its not worth using the LTO settings as the code hardly seems any smaller or faster with any of the LTO options selected and often causes the core to break. |
I'm not using LTO, command line opt to arduino-builder is o3std
Win10 attempt |
OK, I think I'm on to something. I stepped through init and found the hang in setup_adcs() in adc_f1.c adc_foreach, I commented out
and RE O3 started running. Its almost 3AM in Colorado. Going to bed, I'll continue debugging tomorrow. |
checked one more thing, RE ADC3 setup dies in adc_enable
OK, now I'm going to bed. |
This morning I tried to figure out why adc_enable(ADC3) fails *bb_perip(&dev->regs->CR2, ADC_CR2_ADON_BIT) = 1; fails. ADC3 dev address is correct. ADC3->CR1 is 0x00, so EOCIE is not set. Seeking advice what to look for. Thanks. |
I think the problem is that there is no entry for RE chip in this list: |
There is, in line 126. |
Hadn't thought to check the ID, good idea. Mine is listed as F1 high-density with 64K/512K which is 103RE. You might be on to something with the relabeling. holla@hendrix[511]: st-info --probe |
I verified my part has 512K flash by writing and reading a random file to flash. |
So the ID is matching for an RE MCU. I am honestly running out of ideas. Do you have a second board to test? |
Not yet, I'm doing an initial prototype verification. Then I'll spin the
board for first version. Please leave this issue open for a while and I'll
get back to you. I may have something in about 3/4 weeks. Or maybe I should
just switch the MCU on this board, see check results. That can happen
almost immediately. I'll do that next week. Thanks for verifying and the
comments on this issue. Happy New Year and hope you have a bright 2020!
…On Mon, Dec 30, 2019 at 9:50 PM victorpv ***@***.***> wrote:
So the ID is matching for an RE MCU. I am honestly running out of ideas.
Do you have a second board to test?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#719?email_source=notifications&email_token=AAH2EHXKSMYDJV5NP6XV6UTQ3LFRPA5CNFSM4JR6GQT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH3W2NY#issuecomment-569863479>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH2EHRE2J6O4LSLSA2RH7TQ3LFRPANCNFSM4JR6GQTQ>
.
--
Dr. Craig Hollabaugh
[email protected]
https://www.linkedin.com/in/craighollabaugh/
970 690 4911
|
Can you upload your bin somewhere? I can test flashing it to my board to confirm if it does the same. |
Here's my non-functional blink build directory, ie fn(ADC3) is compiled in. |
which pin should be blinking if it works fine? |
PC13 and PA0
|
Also, when I run this bin file, the leds are both on, running dim and my cpu becomes locked. stlink can't read its ID. I have to unlock it to be usable again. |
I noticed something else that might point to bad part. My previously tested EEPROM flash code doesn't work correctly either. EEPROM.read always returns 0xFF. Let me switch out the MCU on this board and get back to you. Thanks. |
I swapped the MCU today with another 103RET from a different lot and different supplier (Digikey vs LCSC). Same result with my blink script. MCU hangs on ADC3 initialization and MCU has to be unlocked to be flashable again. |
Could you eventually debug line by line in instruction mode so that you can check the registers and stack pointer at the exact location where the MCU hangs. |
will do. |
Well, I'm frustrated now. After 3 hours of trying to find where enabling ADC3 dies and get inconsistent results. Probably because I'm not very experienced with gdb. I'm compiling with device_variant=STM32F103RE and opt=ogstd (debugging).
setup_adcs eventually calls adc_set_sample_rate, I can single step through I'm not able to find the exact spot where f103re blink fails. Again, this probably due to my gdb inexperience. |
You have to step on assembly lines, not C code lines. |
Folks,
I'm writing after 8 or so hours of tinkering with F103FB and F103RE variants. I have a custom board with STM32F103RET6. Using blink.ino and STLINK (no maple bootloader), using the STM32F103RB variant, works fine, when I switch to STM32F103RE, blink doesn't start. In fact, after I flash the RE bin, the CPU no longer responds to st-info --probe. I then have to use openocd to unlock the processor.
I've checked the linker scripts to make sure the ram and rom locations and lengths are correct. Verified this in the map file.
The RE variant defines, MCU_STM32F103RE, which in turn defines
define STM32_SRAM_END ((void*)0x20010000)
define STM32_HIGH_DENSITY
STM32_SRAM_END is correct for 64K ram.
defining STM32_HIGH_DENSITY, affects these files.
cores/maple/HardwareTimer.cpp
cores/maple/HardwareTimer.h
cores/maple/libmaple/adc_f1.c
cores/maple/libmaple/dma_f1.c
cores/maple/libmaple/rcc_f1.c
cores/maple/libmaple/spi_f1.c
cores/maple/libmaple/stm32f1/performance/isrs.S
cores/maple/libmaple/stm32f1/performance/vector_table.S
cores/maple/libmaple/timer.c
cores/maple/libmaple/usart_f1.c
cores/maple/sdio.cpp
cores/maple/tone.cpp
libraries/MapleCoOS116/examples/coos_display_blink/SPICoOS.cpp
libraries/SPI/src/SPI.cpp
system/libmaple/include/libmaple/bkp.h
system/libmaple/include/libmaple/sdio.h
system/libmaple/stm32f1/include/series/adc.h
system/libmaple/stm32f1/include/series/dma.h
system/libmaple/stm32f1/include/series/spi.h
system/libmaple/stm32f1/include/series/stm32.h
system/libmaple/stm32f1/include/series/timer.h
system/libmaple/stm32f1/include/series/usart.h
system/support/doxygen/Doxyfile
I'm now in the process of looking through these files to figure out my problem. Any advice on where to start?
Thanks,
Craig
The text was updated successfully, but these errors were encountered: