Hi,
Work just threw me the task of creating a proto board using a Cortex M3 chip from the ground up when I have never done embedded programming before. Suffice it to say that I am very overwhelmed. I started by using the example programs from ST (the board I am using is an STM32-H103) and was able to get the light blinking and was also able to get my computer to recognize the USB as a virtual com port.
However, the Virtual_Com_Port project created July of this year does not perform any actual read/write functions between the USB and computer. It does include commands that I should be able to use, specifically USB_To_USART_Send_Data and USART_To_USB_Send_Data (both are included below). What is meant by the data being sent between the USART and USB? How is it also sent/received by a program like Hyperterminal on my computer? I am confused by the use of the term USART since it seems like sometimes it is used to describe the pins accessible via the USB on the chip and sometimes means something totally different.
I read a post elsewhere by a person who said that he was able to get this function to communicate with Hyperterminal by 'turning off USART', but do not understand what he meant by that. The post is over a year old so I doubt he would respond were I to write and ask him.
Any information would be helpful.
Thanks.
/*******************************************************************************
* Function Name : USB_To_USART_Send_Data.
* Description : send the received data from USB to the UART 0.
* Input : data_buffer: data address.
Nb_bytes: number of bytes to send.
* Return : none.
*******************************************************************************/
void USB_To_USART_Send_Data(uint8_t* data_buffer, uint8_t Nb_bytes)
{
uint32_t i;
for (i = 0; i < Nb_bytes; i++)
{
USART_SendData(EVAL_COM1, *(data_buffer + i));
while(USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TXE) == RESET);
}
}
/*******************************************************************************
* Function Name : UART_To_USB_Send_Data.
* Description : send the received data from UART 0 to USB.
* Input : None.
* Return : none.
*******************************************************************************/
void USART_To_USB_Send_Data(void)
{
if (linecoding.datatype == 7)
{
USART_Rx_Buffer[USART_Rx_ptr_in] = USART_ReceiveData(EVAL_COM1) & 0x7F;
}
else if (linecoding.datatype == 8)
{
USART_Rx_Buffer[USART_Rx_ptr_in] = USART_ReceiveData(EVAL_COM1);
}
USART_Rx_ptr_in++;
/* To avoid buffer overflow */
if(USART_Rx_ptr_in == USART_RX_DATA_SIZE)
{
USART_Rx_ptr_in = 0;
}
}