Skip to content

Conversation

@floodmh123
Copy link

No description provided.

HAL_GPIO_WritePin(GPIOB, GPIO_PIN_8, GPIO_PIN_RESET); // lower CS

uint8_t txData[3] = {0x01, 0x80, 0x00}; // transmit 00000001 start; 1000 0000 single-end, d1-3 =0; whatever
uint8_t rxData[3] = {0};//receive, 1. null, 2.first 2 digits, 3. rest 8 digits

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do these arrays need to be inside the loop?


uint16_t result = ((rxData[1] & 0x03) << 8) | rxData[2];

printf("ADC value = %d\n", result);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a serious mistake but printf wouldn't work on the stm32

TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
TIM1.IPParameters=Channel-PWM Generation1 CH1,Prescaler,Period
TIM1.Period=20000
TIM1.Prescaler=47

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's more optimal parameters you can set for the timer

MX_TIM1_Init();
/* USER CODE BEGIN 2 */

/* USER CODE END 2 */
Copy link

@dechair3 dechair3 Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a function you should invoke to start the timer peripheral before your main loop runs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants