Skip to content
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

QSPI flash need read, write via 4 lines not 1 line #41297

Closed
glin00 opened this issue Dec 17, 2021 · 10 comments
Closed

QSPI flash need read, write via 4 lines not 1 line #41297

glin00 opened this issue Dec 17, 2021 · 10 comments
Assignees
Labels
area: QSPI Quad SPI Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32 Waiting for response Waiting for author's response

Comments

@glin00
Copy link

glin00 commented Dec 17, 2021

Describe the bug
The project I am working need to use QSPI flash to store some image data(ex. 5MB size of data). QSPI flash read, write data is working without any problems, but I found that the flash_stm32_qspi_write routine uses QSPI_INSTRUCTION_1_LINE, QSPI_ADDRESS_1_LINE, QSPI_DATA_1_LINE to write data. Is it possible that I can use QSPI_DATA_4_LINES to increase the speed of write? The same is for flash_stm32_qspi_read which uses QSPI_INSTRUCTION_1_LINE, QSPI_ADDRESS_1_LINE, QSPI_DATA_1_LINE to read data. Is it possible that I can use QSPI_DATA_4_LINES to increase the speed of read?

the prj.conf concerning qspi i/f is as following:
#SPI related
CONFIG_SPI=y
CONFIG_SPI_STM32_DMA=y
CONFIG_DMA=y
CONFIG_GPIO=y
CONFIG_GPIO_STM32=y

#flash related
CONFIG_FLASH=y

the dts is as following:

&quadspi {
pinctrl-0 = <&quadspi_clk_pa3 &quadspi_bk1_ncs_pb11
&quadspi_bk1_io0_pb1 &quadspi_bk1_io1_pb0
&quadspi_bk1_io2_pa7 &quadspi_bk1_io3_pa6>;
dmas = < &dma2 7 3 0x0000 >;
dma-names = "tx_rx";

status = "okay";

mt25qu128abaf: qspi-nor-flash@0 {
	compatible = "st,stm32-qspi-nor";
	label = "MT25QU128ABA";
	reg = <0>;
	qspi-max-frequency = <50000000>;
	/* 128 Megabits = 16 Megabytes */
	size = <0x8000000>;
	status = "okay";
};

};

As you can see, I already use SPI DMA and spi clock 40mhz. The next thing to consider to increase access speed is to change 1 line to 4 lines of QSPI i/f.

Expected behavior
QSPI flash read, write using 4 lines data should be possible.

Impact
Wish to use QSPI flash read, write using 4 lines data to increase access speed since the data stored in the flash is quite large(at least 5MB).

Environment (please complete the following information):
Hardware:STM32L496AGI6P
Display: OLED display with 4 wire SPI interface.
Linux Ubuntu 20.04.3 LTS
Zephyr SDK,-0.13.0
Zephyr SHA1 ID:bb85a55

@glin00 glin00 added the bug The issue is a bug, or the PR is fixing a bug label Dec 17, 2021
@erwango
Copy link
Member

erwango commented Dec 17, 2021

No issue description. Closing

@erwango erwango closed this as completed Dec 17, 2021
@glin00
Copy link
Author

glin00 commented Dec 17, 2021

@erwango , please open up this issue since I had filled up all the information I know. If there is any information not enough, please let me know. Thanks.

@erwango erwango reopened this Dec 17, 2021
@erwango
Copy link
Member

erwango commented Dec 17, 2021

@glin00 Can you have a look to #40859, to see if filling the gap ?

@erwango erwango added Enhancement Changes/Updates/Additions to existing features area: QSPI Quad SPI platform: STM32 ST Micro STM32 and removed bug The issue is a bug, or the PR is fixing a bug labels Dec 17, 2021
@erwango erwango self-assigned this Dec 17, 2021
@erwango
Copy link
Member

erwango commented Dec 17, 2021

Also, @glin00 please make the effort to distinguish 'bug' from 'enhacement'.

@erwango erwango closed this as completed Dec 17, 2021
@erwango erwango reopened this Dec 17, 2021
@lmajewski
Copy link
Collaborator

@glin00 The PR #40859 mentioned by @erwango shall fulfill this enhancement request.

@erwango erwango added the Waiting for response Waiting for author's response label Dec 21, 2021
@glin00
Copy link
Author

glin00 commented Feb 10, 2022

@lmajewski . @erwango would you mind to tell me the SHA1 ID of zephyr you are using to test #40859?
I am using SHA1 ID b48276e and I copy paste the files you changed in #40859 and there are some compiling errors(see below)which I am trying to solve now.

But I think the quickest way is to know which SHA1 ID of zephyr you are using, so I can spend less time to solve this problem.
Or, can you suggest me how to solve this compiling error?

178/301] Building C object zephyr/dri...vers__flash.dir/flash_stm32_qspi.c.obj
FAILED: zephyr/drivers/flash/CMakeFiles/drivers__flash.dir/flash_stm32_qspi.c.obj
ccache /home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DBUILD_VERSION=v2.7.99-1360-gb48276e9954a -DCORE_CM4 -DHSE_VALUE=8000000 -DKERNEL -DLV_CONF_INCLUDE_SIMPLE=1 -DSTM32L496xx -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/home/steve/zephyrproject/zephyr/include -I/home/steve/zephyrproject/prj_smallOLED/build/zephyr/include/generated -I/home/steve/zephyrproject/zephyr/soc/arm/st_stm32/stm32l4 -I/home/steve/zephyrproject/zephyr/drivers -I/home/steve/zephyrproject/zephyr/soc/arm/st_stm32/common -I/home/steve/zephyrproject/modules/hal/cmsis/CMSIS/Core/Include -I/home/steve/zephyrproject/modules/hal/stm32/stm32cube/stm32l4xx/soc -I/home/steve/zephyrproject/modules/hal/stm32/stm32cube/stm32l4xx/drivers/include -I/home/steve/zephyrproject/modules/hal/stm32/stm32cube/stm32l4xx/drivers/include/Legacy -I/home/steve/zephyrproject/modules/hal/stm32/stm32cube/common_ll/include -I/home/steve/zephyrproject/prj_smallOLED/drivers/zephyr/. -isystem /home/steve/zephyrproject/zephyr/lib/libc/minimal/include -isystem /home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include -isystem /home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include-fixed -Os -imacros /home/steve/zephyrproject/prj_smallOLED/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -imacros /home/steve/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/home/steve/zephyrproject/prj_smallOLED=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/steve/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/steve/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT zephyr/drivers/flash/CMakeFiles/drivers__flash.dir/flash_stm32_qspi.c.obj -MF zephyr/drivers/flash/CMakeFiles/drivers__flash.dir/flash_stm32_qspi.c.obj.d -o zephyr/drivers/flash/CMakeFiles/drivers__flash.dir/flash_stm32_qspi.c.obj -c /home/steve/zephyrproject/zephyr/drivers/flash/flash_stm32_qspi.c
In file included from /home/steve/zephyrproject/zephyr/drivers/flash/flash_stm32_qspi.c:16:
/home/steve/zephyrproject/zephyr/include/drivers/pinctrl.h:24:10: fatal error: pinctrl_soc.h: No such file or directory
24 | #include <pinctrl_soc.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
[187/301] Building C object modules/lv..._lvgl.dir/src/lv_hal/lv_hal_tick.c.obj
ninja: build stopped: subcommand failed.

@lmajewski
Copy link
Collaborator

@glin00

Compiler: Found host-tools: zephyr 0.13.1
Branch: upstream/main
SHA1: 9e4968b
Compilation: west build -p always -b nucleo_h743zi ./zephyr/samples/subsys/fs/littlefs
Flashing: west flash

@glin00
Copy link
Author

glin00 commented Feb 10, 2022

After I changed to SHA1: 9e4968b, I can build successfully using "west build -p always -b nucleo_h743zi ./zephyr/samples/subsys/fs/littlefs".

But when I try to build my own project which was build successfully with SHA1 ID b48276e, I got the following errors using 9e4968b which I am now trying to solve. @lmajewski Do you have any ideas why this happen?

[296/306] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/steve/zephyrproject/prj_smallOLED/build/zephyr/zephyr_pre0.map
: && ccache /home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -fuse-ld=bfd -Wl,-T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=/home/steve/zephyrproject/prj_smallOLED/build/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/lib/posix/liblib__posix.a zephyr/lib/gui/lvgl/liblib__gui__lvgl.a zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/drivers/interrupt_controller/libdrivers__interrupt_controller.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/dma/libdrivers__dma.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/i2c/libdrivers__i2c.a zephyr/drivers/spi/libdrivers__spi.a zephyr/drivers/flash/libdrivers__flash.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a modules/stm32/stm32cube/lib..__modules__hal__stm32__stm32cube.a modules/lvgl/lib..__modules__lib__gui__lvgl.a modules/drivers/lib..__prj_smallOLED__drivers__zephyr.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"/home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/thumb/v7e-m/nofp" -L/home/steve/zephyrproject/prj_smallOLED/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a -no-pie -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn && cd /home/steve/zephyrproject/prj_smallOLED/build/zephyr && /usr/bin/cmake -E echo
/home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/i2c/libdrivers__i2c.a(i2c_ll_stm32.c.obj): in function pinctrl_apply_state': /home/steve/zephyrproject/zephyr/include/drivers/pinctrl.h:345: undefined reference to pinctrl_lookup_state'
/home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/i2c/libdrivers__i2c.a(i2c_ll_stm32.c.obj): in function pinctrl_apply_state_direct': /home/steve/zephyrproject/zephyr/include/drivers/pinctrl.h:326: undefined reference to pinctrl_configure_pins'
/home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/spi/libdrivers__spi.a(spi_ll_stm32.c.obj): in function pinctrl_apply_state': /home/steve/zephyrproject/zephyr/include/drivers/pinctrl.h:345: undefined reference to pinctrl_lookup_state'
/home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/spi/libdrivers__spi.a(spi_ll_stm32.c.obj): in function pinctrl_apply_state_direct': /home/steve/zephyrproject/zephyr/include/drivers/pinctrl.h:326: undefined reference to pinctrl_configure_pins'
/home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/flash/libdrivers__flash.a(flash_stm32_qspi.c.obj): in function pinctrl_apply_state': /home/steve/zephyrproject/zephyr/include/drivers/pinctrl.h:345: undefined reference to pinctrl_lookup_state'
/home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/flash/libdrivers__flash.a(flash_stm32_qspi.c.obj): in function pinctrl_apply_state_direct': /home/steve/zephyrproject/zephyr/include/drivers/pinctrl.h:326: undefined reference to pinctrl_configure_pins'
/home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/serial/libdrivers__serial.a(uart_stm32.c.obj): in function pinctrl_apply_state': /home/steve/zephyrproject/zephyr/include/drivers/pinctrl.h:345: undefined reference to pinctrl_lookup_state'
/home/steve/zephyr-sdk-0.13.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/serial/libdrivers__serial.a(uart_stm32.c.obj): in function pinctrl_apply_state_direct': /home/steve/zephyrproject/zephyr/include/drivers/pinctrl.h:326: undefined reference to pinctrl_configure_pins'
collect2: error: ld returned 1 exit status

@lmajewski
Copy link
Collaborator

IIRC there was a pinctrl rework:

tig b48276e9954a11ccf1ebeb93c635f5f16fe8fdb2..9e4968bb901c8dddde661b8f2d0a0046b338a8ab

Please look into: SHA1: 37bf7cb

@erwango
Copy link
Member

erwango commented Mar 21, 2022

Fixed in #40859,.
Please open a new issue if required

@erwango erwango closed this as completed Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: QSPI Quad SPI Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32 Waiting for response Waiting for author's response
Projects
None yet
Development

No branches or pull requests

3 participants