SPI limited to 520 bytes


Hello All.
I am having a problem with the SPI interface of Q2501B.
Basically when I send or received more than 520 bytes, the module freezes.
To simulate the problem, just create a Handler for SPI Bus and run the following instruction:

static adl_busAccess_t SpiBus_Header = { 0, 0, 8, 24 };

adl_busWrite ( SPI_Handler,
               521, // <--- Above 520 the module crashes.

Any help will be welcome.

Odilon Ferreira
Belo Horizonte - Brasil


Hello Odilon, you may check how your buffer is declared.
If “buffer” location is in your Open AT stack memory, you also may need to increase the default stack size set to 256 bytes that may not be enough for what you are trying to do?

Parameter: u32 wm_apmCustomStack [ 256 ];

Hope this help ?


Thanks for your help DeleteAll.
I changed u32 wm_apmCustomStack to 512, 1024, 2048 … without success. I also verified the “buffer” arrays and it is OK, with 600 bytes.
To contour the problem, I’m accessing the SPI Bus with values below 520 bytes, through multiples requests. This procedure fixed the problem.



It seems that the maximum DataLen value for adl_busWrite is 512.


Have you tried in Target mode ?

It seems this problem occurs only in Remote mode.


Sorry for the delay Jay.
I only tested the IOs in remote mode.
Not in Target mode.


This is due to limitations of REMOTE mode.

For hardware interfaces (IOs, buses, …), flash memory storage and time critical tasks, I suggest you to use the TARGET mode instead of the REMOTE mode.

You can add traces in your source code to debug in TARGET mode.