cancel
Showing results for 
Search instead for 
Did you mean: 

how to read UART messages in SPC58 ?

asfakm
Associate
/****************************************************************************
*
* Copyright © 2016-2019 STMicroelectronics - All Rights Reserved
*
* This software is licensed under SLA0098 terms that can be found in the
* DM00779817_1_0.pdf file in the licenses directory of this software product.
* THIS SOFTWARE IS DISTRIBUTED "AS IS," AND ALL WARRANTIES ARE DISCLAIMED, 
* INCLUDING MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
 
/* Inclusion of the main header files of all the imported components in the
   order specified in the application wizard. The file is generated
   automatically. */
#include "components.h"
#include "serial_lld_cfg.h"
#include <string.h>
 
uint8_t message[] = {0x01, 0x03, 0x04, 0x04};
uint8_t messageR[7];  // Buffer to store the 8-byte received packet
 
 
int ret = 0;
 
/*
 * Application entry point.
 */
int main(void) {
    /* Initialization of all the imported components in the order specified in
       the application wizard. The function is generated automatically. */
    componentsInit();
 
    /* Enable Interrupts */
    irqIsrEnable();
 
    /* Start Serial Driver */
    sd_lld_start(&SD3, &serial_config_configuration_name);
 
 
 
    sd_lld_read(&SD3, (uint8_t *)messageR, (uint16_t)(sizeof(messageR)));
 
 
    /* Application main loop. */
    for (;;) {
        // Clear RS485 enable (optional, based on your RS485 setup)
 
 
    }
 
 
 
 
 
    return 0; // Should never reach here
}
 
 
 
void rxreceive(SerialDriver *sdp){
(void)sdp;
 
 
 
}
 
void txreceive(SerialDriver *sdp){
(void)sdp;
 
}

I could read the data packets from uart, 

1 REPLY 1
asfakm
Associate

sorry, I could not read the data packets