Anyone have experience with the STM32H750VB board from ebay? I am having trouble with USART1
Using this board from ebay with the STM32H750VB mcu and I have USART1 configured, and it 'functions' but the data I send from the pc is not what the board is getting. I had to download several serial clients until I found one that would read parity as 'space' and that made it work correctly but I have no parity configured on the board, and Im stumped as to why its not getting what I am sending.
If I send the letter 'A' (ascii 65) the board gets decimal 160. The MSB seems to be set sometime when it shouldn't be, and I cannot figure out whats causing it. Ive spent close to 50 hours trying to figure this out. Anyone have any ideas?
I got some basic pinout and description info from a post @Community member made a few months ago, and I thought it was working correctly but then noticed this data problem. I've used cubemx to generate all code, I've hand written it based on reg values from the reference manual, and I have tried several examples from various places on the web.
__GPIOA_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.Pin = GPIO_PIN_9;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Alternate = GPIO_AF7_USART1;
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.Pin = GPIO_PIN_10;
GPIO_InitStructure.Mode = GPIO_MODE_AF_OD;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
__USART1_CLK_ENABLE();
//Most of these registers are already at zero when reset. but im getting desperate.
//set word length. 2 bits
USART1->CR1 &= ~(USART_CR1_M0); //00 = 1s,8d,Ns
USART1->CR1 &= ~(USART_CR1_M1); //01 = 1s,9d,Ns
//10 = 1s,7d,Ns
//set stop bits
USART1->CR2 &= ~(USART_CR2_STOP_0 | USART_CR2_STOP_1); //00=1 stop bit
//01=.5 stop bit
//10=2 stop bit
//11=1.5 stop bit
//set parity
USART1->CR1 &= ~(USART_CR1_PCE); //0=parity control disabled
//1=parity control enabled
//set msb/lsb
USART1->CR2 &= ~(USART_CR2_MSBFIRST); //0=0 bit first
//1=7/8 bit first
//set flow hw control
USART1->CR3 &= ~(USART_CR3_RTSE | USART_CR3_CTSE); //0=turn of ready to send and clear to send
//set tx/rx enable
USART1->CR1 |= (USART_CR1_RE | USART_CR1_TE); //enable transmit and receive
//set over sampling
USART1->CR1 &= ~(USART_CR1_OVER8); //0=over sample by 16
//1=over sample by 8
//set interrupts
USART1->CR1 |= (USART_CR1_RXNEIE_RXFNEIE); //enable interrupts
//set FIFO
USART1->CR1 &= ~(USART_CR1_FIFOEN);
uint32_t Baud = 9600;
//set baud rate
//((clkspeed/prescaler) + (baudrate/2))/baudrate
USART1->BRR = ((HAL_RCC_GetPCLK2Freq() / 1) + (Baud / 2U)) / Baud;
USART1->CR1 |= (USART_CR1_UE);
/* Peripheral interrupt init*/
HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USART1_IRQn);