cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to use CORDIC on a NUCLEO-G431RB. I have some example code but its almost like the CORDIC module is not responding. In CubeMX I have enabled CORDIC but no MX_CORDIC_Init() function appeared in the main.c code (should that function be there?

rclar.6
Senior

How do I initialise it? Do I need to swith on an internal peripheral Bus?

3 REPLIES 3
rclar.6
Senior

not an answer but for more info. All the registers, in the debugger contain 0x50. But writing or reading from them seems to make no difference.

rclar.6
Senior

Mysteriously this morning the gui changed and I now have all the HAL libraries!

rclar.6
Senior

       CORDICsConfig.Function = CORDIC_FUNCTION_COSINE; // Needs M and theta of M.Sin(theta)

       CORDICsConfig.Scale = 0;// CORDIC_CSR_SCALE_0 == Q1.32 or B1 making this 0 makes it B0 as it should be

       CORDICsConfig.NbWrite = CORDIC_NBWRITE_2;

       CORDICsConfig.NbRead = CORDIC_NBREAD_2;

       CORDICsConfig.InSize = CORDIC_INSIZE_32BITS;

       CORDICsConfig.OutSize = CORDIC_INSIZE_32BITS;

       CORDICsConfig.Precision = CORDIC_PRECISION_15CYCLES;

       HAL_CORDIC_Configure(&hcordic, &CORDICsConfig);

This seems to work fine for sines and cosines and atan2 (called modulus)

However, the CORDIC_CSR_SCALE_0 (I think) should be named CORDIC_CSR_SCALE_1

To get this working I had to force a zero in.

With CORDIC_CSR_SCALE_0 I get what I would expect would be B1 scaling.