Porting decawave API to custom board

Hello, I’m working on a custom DWM1000 + STM32F103C4T board and want to port decawave API.
I’m working with SystemWorkbench as IDE and trying to use HAL instead of stdperiphlibrary.
I manage to get SPI comm working twiking some files but I want to know the right way to port API to new platform.
Does anybody working on it?



Its pretty straight forward, indeed.
Attached is how my deca_port.c looks like.
Although I don’t use SystemWorkbench, I believe HAL has to be the same.
Please pay attention to decaspifast and decaspislow functions, as soon as dividers (SPI_BAUDRATEPRESCALER_xx) has to match your clock settings.

Sorry for may be offtopic, just want to share my setup for stm dev. env. - may be it will help anybody as well…
I prefer QtCreator as an IDE for historical reasons. The bunch of HAL’s code for stm32 is generated by STM32CubeMX. It is very convenient tool indeed! Worth trying it! Clocks setup, pin setup, periph setup, chip select, power consumption - everything is done in seconds. Then you push Generate you receive all necessary sources with all periph ready and initialized. In my case, I generate the code for SW4STM32 toolchain. Then show generated folder to CubeMX2Makefile.pl utility (https://github.com/baoshi/CubeMX2Makefile) and receive complete project, ready to be compiled. Besides, If you will respect the STM32CubeMX’s placement for your custom code (main loop, etc), it will keep it intact if you regenerate your project from CubeMX. So, changing platform, pin reassignment, etc will not affect your code and whole project - very convenient for R&D.

Thank stan! I can see that you join port.c and deca_spi on one file and remove a lot of code. I like it. I just finish to tweak my port.c to make it work ok.
So the way to go is add all decadriver folder source code to our project, then add port.c/port.h and modify them to match our library code.

I use CubeMX code genrator too, but have some problems using it out the box with my custom code. I know that systemworkbench is not mature and need a lot of work, but it is the ST official IDE and used to use it on my projects.
I will take part of your code. Can you share deca_port.h, please?


Here we go!

I tied official ST’s IDE as well, but it couldn’t beat QtCreator

again, check my code as soon as

#define DWM1000_TIMEOUT_ms 500

may look to be too long timeout… don’t know, why I put this way ))

here is my clicker’s (https://shop.mikroe.com/development-boards/starter/clicker/stm32f4) STM32CubeMX project file. Just to be complete…

Thank stan, I take some part of your code. I have some doubt about IRQ signals. Could you provide your GPIO and NVIC configuration around DWM1000 IRQ signal, please?


No prob!
here it is. Please note, that this code is copyrighted by STMicroelectronics International N.V.
The code indeed is automatically generated from STM32CubeMX editor, so I only put appropriate pin names in GUI