Skip to main content
sanjib
Associate III
May 9, 2014
Question

F030 USART half dupliex

  • May 9, 2014
  • 26 replies
  • 4427 views
Posted on May 09, 2014 at 14:40

The original post was too long to process during our migration. Please click on the attachment to read the original post.
    This topic has been closed for replies.

    26 replies

    Tesla DeLorean
    Guru
    May 9, 2014
    Posted on May 09, 2014 at 15:53

    PLEASE PLEASE Learn How to use the Format Code Block tools (Paintbrush [<>] icon)

    So do any GPIO get enabled on Board2?

    void RCC_Configuration(void)
    {
    #if Board1
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
    #endif
    #if Board1
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
    #endif
    #if Board2
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
    #endif
    }

    In C, NUL terminated strings take an extra character, and the compiler is capable of figuring out how long it is.

    #if Board1
    uint8_t imu_data[7] = ''SANJIBD'';
    ..
    #if Board2
    uint8_t ACK[12] = ''BABABABABABA'';

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    sanjib
    sanjibAuthor
    Associate III
    May 12, 2014
    Posted on May 12, 2014 at 07:19

    Thanks Clive and sorry too.

    NOW I have made the configuration for both the boards, I mean to say both the boards are using USART1.

    For instance

    void RCC_Configuration(void)

    {

        RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);

        RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);

        RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);

    }

    Still not working
    sanjib
    sanjibAuthor
    Associate III
    May 12, 2014
    Posted on May 12, 2014 at 14:55

    Hi Clive

    I found some problem like for board 2 USART_Init(USART1, &USART_InitStructure) in USART_init was missing after adding this line and for checking purpose I have made the BOARD 2 as transmitter (checked with the same board as PB6 of the same board as acting transmitter and receiver alternately I mean half duplex) and I have found that it is able to transmit and received interrupt is also occuring but it occur for once only. that means it comes to only case 0 . but if I checked the variable USART2_SRC it is showing 0 (in debuuger).....In the same way I have checked in the BOARD 1 it is perfectly fine with the received interrupt I mean it is entering in every cases but USRT1_SRC ,USART_CMD and other variables shows value zero rather than showing SA of SANJIBD (checked same like BOARD 2).
    sanjib
    sanjibAuthor
    Associate III
    May 13, 2014
    Posted on May 13, 2014 at 06:22

    Can anybody help me

    Tesla DeLorean
    Guru
    May 13, 2014
    Posted on May 13, 2014 at 07:25

    Can anybody help me

    It's going to be limited, I don't have the hardware, and can't afford the time/resources to mock it up. All I can offer is cursory static analysis.

    The PB6 (USART1_TX AF_0) and PA2 (USART2_TX AF_1) seem reasonable enough, but do require an STM32F030R8 device.
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    sanjib
    sanjibAuthor
    Associate III
    May 13, 2014
    Posted on May 13, 2014 at 09:09

    Hi Clive

    Thanks for your reply

    for 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

    ________________

    Attachments :

    BOARD_1_.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I01V&d=%2Fa%2F0X0000000bSF%2FOZniW0HJewFOM39hzvw2QrvyVseG_c0Ww81Mn7I8RYY&asPdf=false

    BOARD_2.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I01Q&d=%2Fa%2F0X0000000bSG%2F6YrJ3H0KhcaThVDyVkHnw8yduJ64ZW7WJMoqQFF3g2o&asPdf=false
    Tesla DeLorean
    Guru
    May 13, 2014
    Posted on May 13, 2014 at 16:16

    I don't like the if-then-else stuff in the IRQHandler, I guess there's opportunity there for it to not do quite what you want, or oscillate.

    Ponder that the IT flags may be set even when you don't have the interrupt enabled, the enablement is a mask which allows the physical interrupt to be generated, but the bit can still assert as a mirror to the status.

    What's ''if(Uart1_Src == 'S'|'A')'' do because it's not checking for S or A

    I would not use TXE as an indicator that the data crossed the wire, just that a holding buffer has started transmission. You should look at the TC bit.

    You might want to test the Tx side, pushing the data into a full-duplex Rx. Look at the whole signal on a scope or logic analyzer, confirm you can see all the bytes you expect to be transmitted.

    Then test the Rx side sending stuff from a Terminal
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    sanjib
    sanjibAuthor
    Associate III
    May 14, 2014
    Posted on May 14, 2014 at 12:27

    It is transmitting ( I have checked with the oscilloscope as well as terminal) but it is not receiving really I am not understanding what is the problem

    sanjib
    sanjibAuthor
    Associate III
    May 14, 2014
    Posted on May 14, 2014 at 12:28

    It is transmitting ( I have checked with the oscilloscope as well as terminal) but it is not receiving really I am not understanding what is the problem

    sanjib
    sanjibAuthor
    Associate III
    May 15, 2014
    Posted on May 15, 2014 at 08:24

    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=false