• AVR Freaks

Hot!Clock and prescaler configuration problem in Simulink master block for MCC generated code

Author
wvdk
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2019/02/11 03:36:51
  • Location: 0
  • Status: offline
2020/09/14 04:21:59 (permalink)
0

Clock and prescaler configuration problem in Simulink master block for MCC generated code

Hello,

I am facing the following problem:
With the code configurator I am setting up some interfaces to be used in Matlab with the aid of C function calls.
 
The CAN interface is dependent on the oscillator configuration. In Simulink, when I activate the PLL to set the desired MIPS, the prescaler, feedback and postscaler are automatically configured.
 
When I am using the same settings in MPLAB to generate the code for the CAN interface via the MCC, it warns that these  settings are not okay for the CAN interface as I want to set it up.
 
The reason is that the prescaler (in my case with 8MHz xtal) is set to weird values like 1.1429MHz instead of by example 2MHz or 4 MHz. 
 
How can I make sure I can set the prescaler, feedback and postscaler properly in the simulink master block, without altering the code after generating the code from matlab? (if not possible, consider this as a feature request)
 
Best regards,
Wim 
#1

2 Replies Related Threads

    Lubin
    Moderator
    • Total Posts : 447
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: Clock and prescaler configuration problem in Simulink master block for MCC generated c 2020/09/14 05:12:47 (permalink)
    0
    Hi Wim,
     
    Internal (intermediate) frequency results from optimization, minimizing one norm error from the mid frequency for each intermediate frequency for example (depends on chip).
     
    Could you share your project (Simulink / MPLAB X - MCC) to get all required informations. (chips, CAN peripheral used with MCC settings)
     
    Thanks,
    Lubin
    #2
    wvdk
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2019/02/11 03:36:51
    • Location: 0
    • Status: offline
    Re: Clock and prescaler configuration problem in Simulink master block for MCC generated c 2020/09/14 06:25:04 (permalink)
    0
    Hi lubin,
     
    I uploaded an example simulink file and the mc3 configuration file (which covers the essence of the case).
    If you would reconfigure the settings in the mc3 file to the oscillator settings in the simulink file, you will see the problem I have.
     
     
    Best regards,
    Wim
     
    PS: I noted that redoing all the steps with the files I added to this posts, it doesn't give a problem anymore, but is probably because I deleted other intefaces from the configuration before uploading, so the qestion is still relevant for me.
    #3
    Jump to:
    © 2020 APG vNext Commercial Version 4.5