cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476RETx integration with MatrixOrbital GTT43A

Kittywapus
Associate

I am working on integrating the Matrix Orbital GTT43A display with my STM32 MCU. Our current display's protocol is RS232, so the code I currently have is set up for this protocol within the STM32Cube IDE.

I created generic receive and transfer buffer: 

uint8_t UART1_rxBuffer[64] = { 0 }; 
uint8_t UART1_txBuffer[64] = { 0 };

I created generic send and receive functions:

int send_data_uart1(gtt_device* device, uint8_t* data, size_t length);
int read_data_uart1(gtt_device* device);

int send_data_uart1(gtt_device* device, uint8_t* data, size_t length){
 
// int i = 0;
HAL_StatusTypeDef jStatus = HAL_UART_Transmit(&huart1, data, length, 100);
if (jStatus == HAL_OK)
return length;
else
return -1; // error occured
 
}
 
int read_data_uart1(gtt_device *device){
 
uint8_t data;
HAL_StatusTypeDef res = HAL_UART_Receive_IT(&huart1, &data, 1);
 
if (res != HAL_OK) {
return -1;
}
else
return data; // no data or error occurred
 
}

I created a instance of the device:

gtt_device Matrix43A;

// initialtize GTT device structure and set the communication functions
Matrix43A.Context = NULL;
Matrix43A.Write = send_data_uart1; // function for writing to uART1
Matrix43A.Read = read_data_uart1; //
Matrix43A.secured_packets = 1; //1 = wrap all outgoing packets with crc protection ; 100ms timeout
Matrix43A.rx_buffer = UART1_rxBuffer;
Matrix43A.rx_buffer_size = sizeof(UART1_rxBuffer);
Matrix43A.tx_buffer = UART1_txBuffer;
Matrix43A.tx_buffer_size = sizeof(UART1_txBuffer);

I initialize and configure the proper peripherals including an interrupt for incoming information from the display:

HAL_UART_Receive_IT(&huart1, UART1_rxBuffer, 1);

 

I  am trying to simply receive the brightness of the display using the function provided by GTTclient Library:

 uint8_t test = 150;
test = gtt_get_backlight(&Matrix43A);

 

but keep get stuck in a loop where the packet is waiting to be completed and HAL is always busy. I can see that the correct value is in the UART1_rxBuffer[0] = 200; but never gets as far as updating the 'test' value.

 

0 REPLIES 0