Open Kanken6174 opened 4 months ago
Bypassing this check solved the second issue for me, it now does send data to my computer, even if slowly.
this quick little hack lets me write data without UART1 and 2 being physically wired together:
void DDWrite(const char* str, unsigned int len){
for(int i = 0; i < len && i < DEF_UARTx_TX_BUF_LEN; i++){
UART2_Rx_Buf[i] = str[i];
}
UARTx_Rx_DMALastCount = len-1;
UARTx_Rx_DMACurCount = len;
}
usage:
int main(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
SystemCoreClockUpdate();
Delay_Init();
USART_Printf_Init(115200);
RCC_Configuration( );
TIM2_Init( );
UART2_Init( 1, DEF_UARTx_BAUDRATE, DEF_UARTx_STOPBIT, DEF_UARTx_PARITY );
Set_USBConfig();
USB_Init();
USB_Interrupts_Config();
printf("SystemClk:%d\r\n",SystemCoreClock);
printf( "ChipID:%08x\r\n", DBGMCU_GetCHIPID() );
printf("USBD SimulateCDC Demo\r\n");
unsigned int ctr = 0;
unsigned int cpt = 0;
const char hello_world[] = "Hello, world!\n";
while(1)
{
if(ctr >= 10000){
DDWrite(hello_world, 14);
ctr = 0;
cpt++;
}
UART2_DataRx_Deal( );
UART2_DataTx_Deal( );
ctr++;
}
}
Hi, i've successfully built and used the "SimulateCDC" example, but it has a few issues:
Please advise on how i could get this to work in a smoother way or if better, more recent samples exist.