Announcement

Collapse
No announcement yet.

Communication problem between STM32 and VisiGenie

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Hi Chiara,

    I got the STM32F411 working. Here is the proper format that worked:

    Code:
    //format for the visi-genie protocol
    uint8_t *on=(uint8_t[]){0x01, 0x13, 0x00, 0x00, 0x01, 0x13};   //var declared as 8-bit pointer to an 8-bit array of hexadecimals corresponding to user led on
    uint8_t *off=(uint8_t[]){0x01, 0x13, 0x00, 0x00, 0x00, 0x12};   /same as above for user led off
    
    //a little delay so the display syncs with the MCU, should be right before the while(1) loop
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, 0);  //turn off the display, PA4 -> RST pin of display
    HAL_Delay(3500);
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, 1);  //turn on the display
    
    
    //Send byte array to UART2
    HAL_UART_Transmit(&huart2, (uint8_t*) on, 6, HAL_MAX_DELAY);   //turn the user led on
    
    HAL_UART_Transmit(&huart2, (uint8_t*) off, 6, HAL_MAX_DELAY);   //turn the user led off
    Will be testing out strings and update.
    Last edited by geldy; 23 June 2022, 03:45 PM.

    Comment


    • #17
      Good morning, thank you very much!
      Can I also ask you which are the configurations you set? I mean timers, clock, prescaler, ARR and so on...
      ​​​​​​

      Comment


      • #18
        Hi Chiaki,

        So far I have tested at both 16 MHz(default) and 100MHz (max for STM32F411) HCLK and just let Cube IDE resolve any clock problems (see attached photos).

        I have found the code that works reliably with both to be:

        Code:
        //format for the visi-genie protocol
        uint8_t *on=(uint8_t[]){0x01, 0x13, 0x00, 0x00, 0x01, 0x13}; //var declared as 8-bit pointer to an 8-bit array of hexadecimals corresponding to user led on
        uint8_t *off=(uint8_t[]){0x01, 0x13, 0x00, 0x00, 0x00, 0x12}; //same as above for user led off
        
        //a little delay so the display syncs with the MCU, should be right before the while(1) loop
        HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, 1); //turn on the display
        HAL_Delay(3500);   //wait for display to sync
        I moved the display reset to
        Code:
        PA5
        to avoid conflicts. The delay should be located after the GPIO and USART init calls but before the while(1) loop. The data itself for the Visi-Genie protocol can be anywhere within the main function as long as it's before the while(1) loop.
        Attached Files

        Comment


        • #19
          Which kind of conflicts are there with the reset pin connected to PA4? My PA5 is the Green LED of the nucleo

          Comment


          • #20
            Sorry, but the code you wrote does not work with my STM board. I don't know why actually.
            If I run directly the code, nothing happens.
            If I debug it, instead, I only see the display turning off and turning on because of the reset command, but the UART Transmit does not work, hence I don't see the LED turning on...

            Comment


            • #21
              Hi Chiaki,

              In response to this:

              Originally posted by Chiara View Post
              Which kind of conflicts are there with the reset pin connected to PA4? My PA5 is the Green LED of the nucleo
              PA4 on my board may interfere with USART. You can use any other pins as GPIO out for the reset.

              As for the UART Transmit, it may need some configuring to work with the display properly. How are your clocks configured? If I remember correctly, the STM32F401 only goes up to 84 MHz so the clocks, prescalers etc. may be a little different. Can you send me the code of your project so I can check? You may wish to send it via a ticket: https://helpdesk.4dsystems.com.au/hc/en-au/requests/new if you do not want to post it here.

              Regards,

              Geldy

              Comment


              • #22
                I've just submitted the request on that link. I attached the .ioc file and the main code

                Comment

                Working...
                X