Hi, everyone. I import the example model "uart_model_pnt" into the Simulink, as the picture shows below. But when I build the model and flash it into the MCU directly with Bootloader , it doesn't run.
The model is from Model-Based Design Toolbox for MPC5744P. And I work with the S32DS and Devkit-MPC5744P.
I think the model means: Once the MCU receives a byte from PC, it will transmit a same one byte back to the PC. Is that right?
And then I configure it to adapt the Devkit-MPC5744P, for example, change the receive pin. And I congure and start the Rappid Bootloader to flash it into the MCU directly, as the picture shows below.
But the MUC doesn't run as the model shows. I have tried everything but I still don't know where the error is. The Simulink model is in the attachment.
I do appreciate it if you could help.
BTW:
Is there any document to decribe the example model in the MBDT?
Hello 1506840872@qq.com,
I've tested the model attached and it works fine.
To solve your problem, I would try the following things:
1. I would be sure that the code reaches the flash. For that have you flashed the srec bootloader on the board using S32DS? In order to transfer the mot file, the board must run the bootloader. Have you restart the board and press the "OK" in the following attached window? Also please follow if the RAppId bootloader erases and the uploads the code.
2. Add a blinker on the model in the step function. If the LED blinks, then the code runs on the board, and then is a UART communication issue.
3. Be sure that the COM port is the right one (COM5? for your PC) and the baud rate set in the LIN1 is 19200 8n1. Those settings are made in the LinFlexD1 block.
Best Regards,
Marius
Thank you Marius.
I add a blinker on the model in the step function as you indicate, it works fine.
Actually I connect the EVB to PC in two ways. The first way is to connect PC through openSDA and microUSB , the other way is to add a dupont line to connect the MCU pin and RS232 converter, and then connect to the USB port, which is a Serial Port, as the picture shows below.
I found that if to communicate through openSDA , it works fine. But if to communicate through SerialPort, it cannot work.
And when flashing srec file into the MCU with bootloader, it is fine to flash through openSDA but not fine to flash through SerialPort.
Can we flash the file with bootloader through Serial Port? You know, if we design the circuit board by ourselves, the bootloader should be through the Serial Port.
Thank you previously.
Hello 1506840872@qq.com,
Now I understand your problem. So you need to use insted of the OpenSDA's USB2Serial an RS232 converter because on the custom board that you are about to design you will not have an OpenSDA. There should be no problem in this setup as long as you use the same PD9, PD12 pins from Serial1 as RX/TX for bootloader.
The reason why your current approach is not successful is that the PD9 and PD12 pins are already connected at the OpenSDA and on this board, the OpenSDA can not be unplugged from power. Long story short, the end to end Serial connection is already done so you can not connect a third participant.
Hope this helps,
Marius
Thank you so much, Marius.
I unplug the microUSB connected to the openSDA and it works well.
But I also found that the duport line connecting the LIN0 and LIN1 cannot be unpluged. So, is the LIN0 necessary in bootloader process? Maybe it is the LIN0 that works in the process? Could I only connect the LIN0 to the Serial Port in bootloader process?
Hello 1506840872@qq.com,
The current bootloader only works on PD9,PD12/Lin1 over Serial connection because this one is connected to OpenSDA.
But, if you want to use the Lin0(PB2 and PB3) pins, in the installation folder (src\tools\BootLoader\RBF_Files) you will find other bootloaders for MPC5744xP. You can try the MPC5744P.rbf or MPC574xP.rbf by flashing them using S32K because one of them might work using Lin0 pins.
Hope this helps,
Marius
Thank you for your reply, Marius.
I open the *.rbf file with txt but just found some characters and numbers.
So, is there any description doc or link to describe the structure, function (including which one LIN module is used) in the *.rbf file?
Thank you.
Hello 1506840872@qq.com,
The bootloader uses the srec encode so you can't read nothing from there.
Please try the following approach:
1. Flash the MPC574xP.rbf
2. Connect the USBtoSerial to PB2 and PB3 Lin0 pins.
3. Try flashing the generated code from Matlab.
4. If the approach is not working you can return to the previous one by flashing the MPC5744P_DEVKIT.rbf
Waiting for your response,
Marius
Hey, Marius.
As you taught, I have tried three rbf files: MPC57x4P.rbf , MPC5744P.rbf , and MPC5744P-Devkit.rbf .
The result is that the MPC57x4P.rbf and MPC5744P.rbf works with LIN0, while MPC5744P-Devkit.rbf works with LIN1.
Now I am able to flash the applicaition srec with bootloader through LIN0 and SerialPort.
Thank you for your help.
Leo Lyu