This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[hal][nrfx_qspi.c] Is it reasonable to check if 'p_buffer' word aligned in 'qspi_xfer'?

Hi Nordic guys,

I'm developing with nrf5340, and meet some problem with writing external flash - nrf qspi flash.

I found it sometime failed in 'flash_area_write' and return -22.

And I debug and find that, in qspi_xfer, line 99 at 'modules/hal/nordic/nrfx/drivers/src/nrfx_qspi.c', it check if the write data buffer's address is word aligned!

That's why it failed at writing nrf qspi flash.

In my opinion, it need to check aligned with 'address', but not 'p_buffer'.

Will any body help and fix me?

BR

Ben

  • Hi Ben

    What version of the nRF Connect SDK are you using for development? On my end (v1.8.0) size_t   length is located at line 99. And to me it seems correct that the length must be word aligned. Let me know if you disagree, or if it is different on your end.

    Best regards,

    Simon

  • Hi Simon

    My SDK version v1.9.1. 

    BR

    Ben

  • Indeed, I guess the buffer needs to be word aligned as well. All pointers need to be word-aligned in an EasyDMA, so the first one will be the one to trig the error code you see.

    Best regards,

    Simon

  • I don't quiet understand why? For we just make use of the context of the buffer. It may be strange and unkind if there is some limitation with the buffer address.

    Take an example, if I just want to skip some header of a buffer, that may likely match the limitation and go failed. How can people use EasyDMA friendly?

    BR

    Ben

  • Hi Ben

    Sorry about the late reply, but I wanted to understand this for myself before answering you. The EasyDMA requires that the buffers are word aligned, that's just a HW requirement I'm afraid. I can ask for the details from a HW perspective if you'd like.

    If you want to skip some of the header of a buffer so that it's not matching the word alignment, you can fill it with empty bytes so it will match the alignment requirement.

    Best regards,

    Simon

Related