Hello, engineers,
I encountered some problems when using the MPC5744P uart communication routine. In the 'uart_echo_mpc574xP', I can receive a U8 element in the serial port 1 interrupt and output it to the serial port, but I want to transfer an array and adjust the receiving size to 10. The other did not make adjustments, but the program did not receive 10 elements and returned as I expected. May I ask where is the problem? Thank you!!
Hello 260068845@qq.com,
So the way the UART transmit/receive blocks work is the following:
- Receive - here you have an input to tell it what size you are expecting to receive (number of bytes)
- Transmit - the transfer size will be automatically set to the dimension of the input (e.g.: if you are using a data store memory block with size 10, you'll start sending 10 bytes)
In your model, by sending directly the output of UART_Receive to the input of UART_Transmit, Simulink sees that as having size 1, so you end up with a 1 byte UART transmit. To fix this, you can put the data in a data store memory (as you can see in the model attached by me). This way, Simulink will see this as a 10B variable, so the transfer size will be set accordingly.
Kind regards,
Razvan.