A121 Integration using STM32CubeIDE
Figure 16: SPI transfer example
Note that the A121 enable signal must be set high at least 2 ms before the SPI transfer.
Figure 17: A121 Enable Signal
6.4
UART Problems
In order to verify the prints over UART we use picocom in Ubuntu:
$ picocom -- imap lfcrlf -- baud 115200 / dev / ttyACM0
We also had to make sure, in main.c, that the baudrate and word length is correct:
huart2 . Init . BaudRate = 115200;
huart2 . Init . WordLength = UART_WORDLENGTH_8B ;
The linker might tell you that you have multiple definitions of the function "_write".
If it happens, remove the
implementation in “syscalls.c” and compile/link again.
6.5
Link Errors
Some users have experienced that STM32CubeIDE 1.0.0 forgets the link order of the libraries. Please check that the RSS
libraries are listed in order stated in section 3.1.3 Libraries.
6.6
Heap Memory Corruption
When asking for more heap, the sbrk function will increase the heap towards the stack. However, it is imperative that
the heap and stack never meet or overwrite each other. Unfortunately, the automatically generated code is using the stack
pointer as border between them when it should use the maximum needed stack. This means that the heap might use some
memory which is later overwritten when the stack is growing.
In the file "Src/sysmem.c" remove the line:
register char * stack_ptr asm (" sp ");
After removing the above line, change the function called "_sbrk" so that it looks like this:
caddr_t _sbrk ( int incr )
{
extern char end asm (" end ");
extern char estack asm (" _estack ");
extern char min_stack_size asm (" _Min_Stack_Size ");
© 2022 by Acconeer AB - All rights reserved
Page 21 of 23