No announcement yet.

Communication problem between STM32 and VisiGenie

  • Filter
  • Time
  • Show
Clear All
new posts

  • Communication problem between STM32 and VisiGenie

    Hi everyone,
    I am trying to connect my 4dsystems display to a nucleo STM32 and make them communicate via UART. However, once I send the following command:

    HAL_UART_Transmit(&huart2, (uint8_t*)&send_cmd, 6, 10)

    my display is not able to receive that instruction, so the led on the display that I want to turn on doesn't activate because it seems that the command is not understood by the display.

    Has someone an idea how to solve this problem or what can be the reason why this UART communication does not work?

  • #2
    Hi Chiara,

    Are you using Visi-Genie for the display and just sending commands via UART for the widgets? How is your system set up?


    • #3
      Yes, I am using Visi-Genie for the display and then I send commands via UART.
      The set up is the following:
      - baud rate = 9600
      - no parity bit
      - 1 stop bit
      ​​​​​​- 5V, GND, RX and RST of the display connected to the corresponding on STM32, where RX is obviously connected to TX
      - UART 2 activated in the asynchronous mode


      • #4
        Hi Chiara,

        The data to be sent via UART should follow the Visi-Genie Standard Protocol (see §3.1 of the Visi-Genie Reference Manual: The format is [Command, Param 1, ..., Param n, Checksum]. The number of parameters depend on the command and the widget/object. The data to be sent via UART should be a byte array (aka unsigned int) of size n, where n is the number of parameters + 2 (for the command and checksum).


        // Write the value of 16 to LED Digits Example, Binary state widgets can only have values of 0 and 1.
        unsigned char send_cmd[6] = {1, 15, 0, 0, 16, 30};   // WriteObject, LedDigits, Index 0, Value: 000 016, Checksum
        HAL_UART_Transmit(&huart2, (uint8_t *)&send_cmd, sizeof(send_cmd)/sizeof(send_cmd[0]), HAL_MAX_DELAY);
        Hope this helps.


        • #5
          Yes, thanks. I've already written that command for a user led, that is more precisely:

          HAL_UART_Transmit (&huart2, (uint8_t*)&send_cmd, sizeof(send_cmd), 10), where my send_cmd is defined as a struct where I have different variables whose values identify the command. So, in the end, what I have is: 01 13 00 00 01 13.

          However, this does not for when I send this command from the STM32 to the display, even though the command is correct.


          • #6
            Hi Chiara,

            Has it worked with other MCU's or do you have other widgets that do work with the STM32? Are you using CubeIDE to program the STM32? Which board do you specifically have? Have you confirmed with, say using a UART to USB, if the commands being sent by the STM32 turns out as intended using a Serial Monitor/Terminal?


            • #7
              I have tried to use this display with an Arduino Board and, with that, it works.

              However, I am interested in making this display communicate with the STM32. The board that I am using is STM32F401 and I am programming with uVision.

              The UART communication display-Nucleo does not work. If I connect, instead, the display to a TTL port, I can see from a serial port that the command I send is working and that the LED on the display turns on.

              To connect the display to the host, I use the gen 4-IB board.


              • #8
                Any ideas? Thank you


                • #9
                  Hi Chiara,

                  Since the display works with other boards, this just means that you need to verify if the byte array that actually comes out of UART2 of the STM32 is the correct format. You can do this by attaching Tx-Rx, Rx-TX and GND-GND of the UART2 of the STM32 to the Serial to USB Adapter and then using a terminal(one can be found in Workshop4 under tools) to read the values.


                  • #10
                    Thank you, but I have also already done what you are suggesting. In fact, I see that the command is correct.

                    It's only the communication STM32-display that doesn't work...


                    • #11
                      Hi Chiara,

                      I'll check if I can get a similar STM32 or at least of the same F4 series and do some tests.


                      • #12
                        Alright. Please, let me know then.
                        Thank you very much!!


                        • #13
                          Hi Chiara,

                          I have an STM32F411 board on the way and should get it by tomorrow or the day after that. I will write some programs in Cube IDE for testing with Visi-Genie. Which widgets in particular are you using in the project so I can include them in the programs?


                          • #14
                            Good morning,

                            Right now, I'm just using an LED and USER LED


                            • #15
                              I've also tried to write a string as object