2014-05-09 05:40 AM
2014-05-14 11:24 PM
can anybody say me why USART2 is not receiving any data what mistake I am doing . I have attacjed the file please have a look.
________________ Attachments : Two_board.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I01G&d=%2Fa%2F0X0000000bSH%2FyEAsAtOtqrP3VeV4aicVRZP9FDOWU7IsSgDb_a5rgm0&asPdf=false2014-05-15 12:15 AM
I did not catch up the whole thread, but I noticed that your last source file is missing GPIOA clock. That could lead to misconfiguration of your USART2 TX/RX pin.
2014-05-15 02:19 AM
Hi laurent thanks for your reply. yes I have missed that but still the same issue is there it is entering one time only in the USART2_RXNE interrupt I mean onle case 0, Rest it is not entering. Moreover for entering first also in the USART2_RXNE interrupt I mean case 0 , USART2_Source variable is showing value 0 instead of A. I am reall not getting it .today is my 12th day on this. I am really hang on it.Please help
2014-05-15 03:53 AM
Actually I got the problem it is not possible it seems because of the pin , I wanted to test two board half duplex commn but for making it convenient to test I have used the USART1 and USART2 of same board but the USART2 doesn't have pins scecially for USART2_TX, It has both USART1 and USART2 which is GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_1)which include both USART1 and USART2 and one more pins is also same type ; I am confirmed as because checked with stm32f407 which is having differnt pins for performing those activity. So I have to drop the idea . I have written code for both board 1 and board 2 separetely .here also the same kind of problem persists like
or understanding purpose I have separated the two codes as BOARD1 and BOARD 2 instead of testing on USART1 and USART2 of same board. I have attached the two files Please have a look Procedure of checking: BOARD 1 Code flash into the BOARD1 and cheked as PB6 is configured as half duplex so I thought no need of connecting wire with any other pin PB6 itself will act as transmit and after that received....... .In the same way I have checked the BOARD 2 (normally It should received mode first but for checking purpose I have configured it to transmit mode to check Problems are 1. In BOARD 1 I have checked data is getting send (txe buffer empty interrupt) ..Received interrupt is also taking place but there is no data in Uart1_Src , Uart1_Dst,Uart1_Cmd variable ? All the variable are showing zero. 2 In BOARD2 I have checked data is getting send (txe buffer empty interrupt) ..Received interrupt is also taking place but it taking for 1 time I mean entering into case 1 . When I checked the variable Uart1_Src of case 0 it too is showing the value zero I have attached the code please see2014-05-15 03:55 AM
Actually I got the problem it is not possible it seems because of the pin , I wanted to test two board half duplex commn but for making it convenient to test I have used the USART1 and USART2 of same board but the USART2 doesn't have pins scecially for USART2_TX, It has both USART1 and USART2 which is GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_1)which include both USART1 and USART2 and one more pins is also same type ; I am confirmed as because checked with stm32f407 which is having differnt pins for performing those activity. So I have to drop the idea . I have written code for both board 1 and board 2 separetely .here also the same kind of problem persists like
or understanding purpose I have separated the two codes as BOARD1 and BOARD 2 instead of testing on USART1 and USART2 of same board. I have attached the two files Please have a look Procedure of checking: BOARD 1 Code flash into the BOARD1 and cheked as PB6 is configured as half duplex so I thought no need of connecting wire with any other pin PB6 itself will act as transmit and after that received....... .In the same way I have checked the BOARD 2 (normally It should received mode first but for checking purpose I have configured it to transmit mode to check Problems are 1. In BOARD 1 I have checked data is getting send (txe buffer empty interrupt) ..Received interrupt is also taking place but there is no data in Uart1_Src ,Uart1_Dst,Uart1_Cmd variable ? All the variable are showing zero. 2 In BOARD2 I have checked data is getting send (txe buffer empty interrupt) ..Received interrupt is also taking place but it taking for 1 time I mean entering into case 1 . When I checked the variable Uart1_Src of case 0 it too is showing the value zero I have attached the code please see ________________ Attachments : Two_Board_Usart1_in_one_code_differentiate_.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzyh&d=%2Fa%2F0X0000000bSJ%2F8QQWcOzhMbQl7_9Ek4uVtQvWLxIXg5zaS8gNDatJ3_8&asPdf=false2014-05-15 10:00 PM
Hi clive please see the code once and give me some idea to try I have tried whatever you said
2014-05-16 03:21 AM
Hi Clive
I have seen your numerous examples on stm32f030R8T6 for USART full duplex which is working fine for me from before but there are no examples for single wire USART half duplex . Ok just help me with a sample code of USART Half duplex interrupt transmit and received sample code . You don't have to see my entire code Or you can see my this code which I am attaching and say me the changes to make it work here it's a simple transmit and received .....in single wire half duplex .....problem is same transmitting is fine I have checked with USB to TTL connector . but received is not happening ...it is just entering the case 0 of received interrupt and terminates....even in case 0 I have checked the USART1_SRC the value it contains is 0 instead of the first transmit data 'S' ________________ Attachments : BOARD_2.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I01B&d=%2Fa%2F0X0000000bSI%2Fub5PSMo5x5CLhWR46PNnub3MBeBlO88BePGA_5M_w_g&asPdf=false2014-05-16 05:12 AM
I'm really not looking to be your development and test guy, and I think I've said several times I'm not using STM32F0 parts in any of my projects.
Isn't the sense here backward? The comments seem to be what you want to doUSART_DirectionModeCmd(USART1,USART_Mode_Tx, ENABLE); // enable RX mode // on startup
USART_DirectionModeCmd(USART1,USART_Mode_Rx, DISABLE); // disable TX mode
I'm not sure if you need to turn TX/RX on and off, once TC asserts the USART should receive off the wire. Turning RX off would just seem to prevent you getting the echo of what you send.
STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\USART\HalfDuplex\main.c
You might want to look for RS485 or Smart Card examples
2014-05-16 05:26 AM
Hi clive
I have tried the example of STM32F10x_StdPeriph_Lib_V3.5.0 before it is working fime with stm32f407 but not f030 as I think USART 2 of stm32f030 have PA2 (both USART1 TX and USART2 TX)and PA14 pins (both USART1 TX and USART2 TX), It doesn't hace separate so I was not able to do that moreover it's a polling method not interrupt . I want a interrupt one2014-05-17 11:34 PM
Hi clive
Please help me