Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SPI does not work without a call to delay(0) #797

Closed
Labels
bug 🐛Something isn't working
@ghent360

Description

@ghent360

I found a very weird issue with the SPI code (may affect others as well).
The code bellow works fine, but produces no SPI signal if you comment out the call todelay(0) in thesetup().

I'm testing this on STM32F407VE MCU.

-----Bug repro code start -----

#include<SPI.h>voidsetup() {delay(0);// You comment this line the SPI does generate produce any signals// the delay code can be placed anywhere in this file the location does not matter.// The pins are specific to my setup, they don't matter for the bug  SPI.setMOSI(PB5);  SPI.setMISO(PB4);  SPI.setSCLK(PB3);  SPI.begin();}voidloop() {  SPI.transfer(0x55);}

-----Bug repro code end -----

The only significant difference I can spot is when I call delay(0), some extra code is linked to the binary. I suspect the SPI code depends on the SysTick handler and does not quite work without it.
I would guess some week linking is causing this weirdness.

Extra code in the working binary:

<HAL_IncTick>:4a03      ldrr2,[pc, #12]; (8000528 <HAL_IncTick+0x10>)6811      ldrr1,[r2, #0]4b03      ldrr3,[pc, #12]; (800052c <HAL_IncTick+0x14>)781b      ldrbr3,[r3, #0]440baddr3, r16013strr3,[r2, #0]4770bxlrbf00nop200001c8 .word0x200001c820000004 .word0x20000004<SysTick_Handler>:b508push{r3, lr}f7fe fb56bl8000518 <HAL_IncTick>f7fe fbd1bl8000612 <HAL_SYSTICK_IRQHandler>f7ff fff8bl8001e64 <noOsSystickHandler>bd08pop{r3, pc}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp