The Thunderboard Forum is no longer active. If you would like to post a question regarding Thunderboard Kits, please use the Bluetooth Forum.

This discussion and its replies are closed

Hi,

I'm using the USART of the Thunderboard EFR32BG22, is it normal that when I use "Printf" or "PrintLog" fonctions in my code the USART send the data ?

I also have a problem I can't send data using the USART_TX fonctions.

  • Discussion Forums
  • 32-bit MCUs
  • Answered
Answered
  • You could refer to the example here:

    https://github.com/SiliconLabs/peripheral_examples/tree/master/series2/usart

     

    If you interested in the retarget function (either route to VCOM or not), you could take a look at below KBA:

    https://www.silabs.com/community/mcu/32-bit/knowledge-base.entry.html/2020/03/26/using_printf_in_mcuapplication-lyuZ

    0
  • Thanks for your reply,

    I'm not using the VCOM pins, I'm using the RX and TX (PA5 &PA6) of the Thunderboard, I don't know if the retarget function is still useful in my case,

    my code is based on the exemple named "usart_async_polled", when I send data in the UART, it's sent both the UART and the serial port and same for the Printf (or PrintLog) fonction.

    0
  • Hi Nabil:  I am transferring this question to the Thunderboard Forum.
    0
  • Sorry, I did not catch your point.

    it's sent both the UART and the serial port and same for the Printf (or PrintLog) function.

    Could you upload your code and elaborate what do you mean by Printf and PrintLog.

    the example usart_async_polled don't have these (Printf and PrintLog).

     

    0
  • Hi luweiguo, Thanks for your reply,

    This is my code , I just want to send a string by the UART when the Usart_Tx and prinf functions send the data both in the Serial port and via uart

    this is my code:

    int main(void)
    {
      uint8_t buffer[BUFLEN];
      uint32_t i, j;
    
      // Chip errata
      CHIP_Init();
    
      // Initialize GPIO and USART1
      initCmu();
      initGpio();
      initUsart1();
    
    
       printf("Hello World \n");
    
       USART_Tx(USART1, 'B');
    
    
    }

     

    this is what I have in the output:

     

                                     

    I'm using Putty as debuger, com5 is the serial port and com7 is the uart (TX/RX pins)

    0
  • The logic thing is when I use Usart_Tx fonction the 'B' have te be sent to the COM7 and the Hello World need to be sent to COM5

    0
  • I don't have the thunderboard BG22 to test on. But could you draw a picture to show your whole test system.

    My understanding is you have a thunderboard BG22 .

    What do you mean by COM7 and COM5 here.

    the github example you quote here don't use printf.

    Do you mind to test the code without any change to see if it works as expected first.

     

    Then made any necessary change step by step per your requirement.

    0
  • Thanks for your reply,

    I'm using a Bridge(COM7) as you said UART-to-USB to see what I can send by the UART in Thunderboard and the COM5 is the serial port (the micro usb port in the Thunderboard or the DC power )

    0
  • I suggest you study the thunderboard BG22 first, 

    the user guide UG415 should be a good start point.

     

    You could 

    1. take a picture of your setup, how you connect the Thunderboard to your PC.

    2. OR draw a picture to show how the thunderboard was connected to your PC.

    I'm using a Bridge(COM7) as you said UART-to-USB to see what I can send by the UART in Thunderboard and the COM5 is the serial port (the micro usb port in the Thunderboard or the DC power )

    I am completely lost what do you mean by 'DC power', 

    I need to know how you get COM5 and COM7 showed in 'device manager' and what USB device they are?

     

     

    0
  • sorry If I was not clear,

    between the Thunderboard (TX/RX pins) and the PC I'm using c23hd-ddhsp-0 (COM7)

    0
  • Then what is the issue when you try the Github example without any change?

    How the c23hd-ddhsp-0 (bridge) was connectedt thunderboard BG22? What pins of BG22 you have connected to bridge.

     

    Could you listed the detailed test procedure:

    step 1:

    step 2:

    ...

    In which step you saw what issue, what's the expected, what abnormality happen you think it was not expected.

    0
  • As I said, the issue is that I need to configure my Thunderboard so that the result of the function Printf to be transmited by the COM5 port and not  both COM7 and COM5(as you can see in the pictures of the two terminals).

    I'm sure that I use the right pins in the Thnderboard BG22 (RX/TX ,PA5/PA6 ,pins12/14)

    0
  • I think part of your problem might be that USART1 which goes to PA5/PA6 also goes to the VCOM the JLINK CDC, which is why you get the same output on both COM ports on your PC.

    You are picking up the same signals and displaying them on two separate PC ports.

    Correct Answer
    0