This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Fixed-point calculation using CMSIS_library or libfixmath

Hi.

I usually used nrf52832 rather than nrf52810 since nrf52832 has an FPU, I rarely considered the computational cost for calculating floating point.

The problem is, I have to use nrf52810 and calculate fractional numbers and trigonometric functions.

This is all the functions that I use. (sine, cosine, square root, addition, subtraction, division, multiplication)

As I know, the CMSIS DSP library is very powerful in calculating fixed-point variables and trigonometric functions.

The library has Q31 or Q15 format but I'm confused about using it right.

Firstly, although the CMSIS DSP library supports fractional numbers between -1 to 1, 

I have to calculate the bigger scale of fractional numbers such as 30.12 for example.

Do I have to map each variable to Q31 and bear the mapped variables in mind?

For example,  adding 30.12 and 20.54 using CMSIS Library, map the 30.12 into 0.3012 and 20.54 into 0.2054.

and using 0.3012 + 0.2054 

Secondly, I found this replies (https://devzone.nordicsemi.com/search?q=libfixmath)

Since this libfixmath library has q16.16 format, I think more it is more flexible to use it for fractional numbers such as 30.12.

But, I'm worried that libfixmath is less powerful than CMSIS Library because libfixmath doesn't support vectors, square root function.

 

Parents
  • Hi

    I am sorry but these kinds of operations is not the nRF52810's strong suit as it has no FPU. I would recommend you to switch to the nRF52832 if you want an application like this. If this is not an option for you, I am not sure how to help. But seeing as you need to do square root functions, which libfixmath doesn't support, I would say go for the CMSIS Library. 

    Lastly, seeing as neither of these libraries are made by Nordic, we are not particularly familiar with them, so you will have to find out about the variable mapping by other means. Maybe you could ask the Arm support team.

    Best regards,

    Simon

Reply
  • Hi

    I am sorry but these kinds of operations is not the nRF52810's strong suit as it has no FPU. I would recommend you to switch to the nRF52832 if you want an application like this. If this is not an option for you, I am not sure how to help. But seeing as you need to do square root functions, which libfixmath doesn't support, I would say go for the CMSIS Library. 

    Lastly, seeing as neither of these libraries are made by Nordic, we are not particularly familiar with them, so you will have to find out about the variable mapping by other means. Maybe you could ask the Arm support team.

    Best regards,

    Simon

Children
No Data
Related