Hello wbj5238@163.com ,
For now we don't have support for controlling PCS to SCK delay or other, but you can achieve that by inserting custom code, using NXP SDK. Let me know if you would be interested in adding this so I can walk you through the steps.
Kind regards,
Razvan.
Hello wbj5238@163.com ,
For now we don't have support for controlling PCS to SCK delay or other, but you can achieve that by inserting custom code, using NXP SDK. Let me know if you would be interested in adding this so I can walk you through the steps.
Kind regards,
Razvan.
Thank you for your reply.I really want to know how to implement this function. Please tell me how to insert custom code.You'd better give me an example to control PCS to SCK delay.
We are looking forward to your reply.
Kind regards,
Bingjian Wang.
Hello wbj5238@163.com ,
For adding custom code to your Simulink models you have more options - one way of doing so you can find detailed in this article on our community - How to use your own C code in our Toolbox (Battery Management System example) .
I will cover another way of doing this, more suited in my opinion for this case where you only need to add 1 line.
Simulink has a block named System Start Function. You can use this block in the model you are using the SPI and there you can add the following line, in the System Start Function Exit Code section.
DSPI_MasterSetDelay(1, 100, 10, 20);
Let me go through the parameter list - you have, in order: instance, delayBetweenTransfers, delaySCKtoPCS, delayPCStoSCK
So in my example, it will set the following:
1 - it will set the delay for SPI INSTANCE 1
100 - it will set the delay between transfer to a minimum of 100ms
10 - it will set the delay between SCK and PCS to minimum 10ms
20 - it will set the delay between the PCS and SCK to minimum 20ms
This is just an example, you will need to tune this parameters as for your needs.
One more thing I'd like to mention is that you will need to put it into the Function Exit Code section so it is guaranteed to be executed after the SPI has been initialized. If this were to be executed before, the application would crash.
This code is only executed once, in the initialization. If you want to add code that would be executed in the main loop, you would need to use a similar block name System Outputs Function.
You can read more details about the function in the NXP SDK doc (you can find it in {TOOLBOX_ROOT}\MPC_Platform_SDK\doc\Start_here.html).
Hope this helps.
Kind regards,
Razvan.
Hello wbj5238@163.com ,
It seems that the zip file is too large to be added here - I put this link instead.
Kind regards,
Razvan.
Hello wbj5238@163.com ,
Sorry for the late reply - it seems that I no longer get emails for new replies on the community. I have attached here a zip containing the documentation for the SDK we are using in the MPC toolbox.
Kind regards,
Razvan.