CORDIC SINE gives wrong result when following a CORDIC PHASE calculation
I am using the CORDIC engine on an STM32G474 to perform an atan2, sin, and cos operations sequentially. Running the code below and testing different inputs yields expected results for atan2, but does not yield expected results for sin and cos. However, the sin/cos operation does yield expected results when commenting out the first CORDIC operation. Essentially, it appears that reconfiguring the CORDIC engine and running a different operation in quick succession yields incorrect results for the second operation. I didn't notice any examples in AN5325 that discussed reconfiguring the CORDIC engine, so I'm not sure how to deal with this issue.
LL_CORDIC_Config(hcordic.Instance,
LL_CORDIC_FUNCTION_PHASE,
LL_CORDIC_PRECISION_6CYCLES,
LL_CORDIC_SCALE_0,
LL_CORDIC_NBWRITE_2,
LL_CORDIC_NBREAD_1,
LL_CORDIC_INSIZE_32BITS,
LL_CORDIC_OUTSIZE_32BITS);
LL_CORDIC_WriteData(hcordic.Instance, cordic_input_x);
LL_CORDIC_WriteData(hcordic.Instance, cordic_input_y);
cordic_angle_result = (int32_t)LL_CORDIC_ReadData(hcordic.Instance);
LL_CORDIC_Config(hcordic.Instance,
LL_CORDIC_FUNCTION_SINE,
LL_CORDIC_PRECISION_6CYCLES,
LL_CORDIC_SCALE_0,
LL_CORDIC_NBWRITE_1,
LL_CORDIC_NBREAD_2,
LL_CORDIC_INSIZE_32BITS,
LL_CORDIC_OUTSIZE_32BITS);
LL_CORDIC_WriteData(hcordic.Instance, cordic_angle_input);
cordic_sin = (int32_t)LL_CORDIC_ReadData(hcordic.Instance);
cordic_cos = (int32_t)LL_CORDIC_ReadData(hcordic.Instance);
