UART problem for STM32 mikromedia

Discuss with MikroElektronika software developers about current library development.
Post Reply
Author
Message
umut3502
Posts: 28
Joined: 13 Sep 2006 00:52

UART problem for STM32 mikromedia

#1 Post by umut3502 » 03 Jan 2013 08:11

I have a STM32 mikromedia. I tried to communicate TX-RX UART my code is below



void main() {
char SYNC[] = "abcdefgh"; //{0xAA, 0x0D, 0x00, 0x00, 0x00, 0x00};
char buf[] = "12345678"; //{0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
unsigned int ii,jj;
char txt_1[4],txt_2[4];

Start_TP();
UART2_Init_Advanced(57600, _UART_8_BIT_DATA, _UART_NOPARITY, _UART_ONE_STOPBIT, &_GPIO_MODULE_USART2_PD56);
Delay_ms(1000);

while (1){

UART2_Write_Text(SYNC);

if (UART2_Data_Ready()==1){
TFT_Write_Text("send sync", 60, 200);
UART2_Read_Text(buf,"d", 255);
break;}}

while (1) {
for(jj=0;jj<6;jj++){
ByteToStr(buf[jj], txt_2);
TFT_Write_Text(txt_2, 10, 20*(jj+1));}
}
}

but "buf" value didn't show on TFT screen
the problem this code
UART2_Read_Text(buf,"d", 255);
is it correct?
please help me

best regards

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: UART problem for STM32 mikromedia

#2 Post by filip » 04 Jan 2013 10:16

Hi,

First of all, did you try the simple UART example given in the compiler, just to make sure that the hardware and connections are good ?

Regards,
Filip.

Post Reply

Return to “Library Development Discussion”