Author Topic: Getting Started With a Custom PCB  (Read 3371 times)

Offline MU

  • Newbie
  • *
  • Posts: 2
    • View Profile
Getting Started With a Custom PCB
« on: March 14, 2019, 11:34:59 PM »
Hello, I'm new to uTasker and am working with a custom PCB which already has working application code using FreeRTOS. The main goal right now is to get the uTasker Serial Loader working in USB host mode so that field upgrades can be done with a thumb drive. The processor being used is the Kinetis MK20DN512.

I've been reading the Serial Loader User's Guide and forum posts, but could still use some help getting started.

1.) The MK20DN512 processor does not have it's own eval board. When you download the NXP SDK, they point you to the twrk60d100m as the closest option. Should I select this eval board in config.h? If so do I then simply modify the following code to use the correct processor (and change other settings as necessary), or is there a better approach?

2.) Apart from config.h and app_hw_kinetis.h are there any files in the serial loader which will need modified?

3.) Any other tips?

Thanks!

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Getting Started With a Custom PCB
« Reply #1 on: March 15, 2019, 02:45:35 AM »
Hi

In the case of the MK20DN512 it is in fact basically an MK60DN512 without Ethernet.
Therefore one strategy would be to select the TWR_K60D100M target and ensure that ETH_INTERFACE is not enabled (or add DEVICE_WITHOUT_INTERNET in its section to be sure).
You may be able to leave app_hw_kinetis.h untouched, unless you prefer to add a dedicated target (based on a copy of the same tower board with any custom edits on top - maybe to use a different crystal or different LEDs and switches, for example).
Beware that the TWR boards with Ethernet tend to have a 50MHz oscillator as default so you will likely need to switch this (in app_hw_kinetis.h) to the crystal option, which is often available as option on the board too. To do this use something like
    #define OSC_LOW_GAIN_MODE [this depends on the circuit - use only when there are no loading caps and resistor]
    #define CRYSTAL_FREQUENCY    12000000                                // 12 MHz crystal
    #define _EXTERNAL_CLOCK      CRYSTAL_FREQUENCY

instead of
        #define EXTERNAL_CLOCK           50000000                        // this must be 50MHz in order to use Ethernet in RMII mode
        #define _EXTERNAL_CLOCK          EXTERNAL_CLOCK

remembering that for USB host mode you need to ensure that you have an accurate crystal source to comply with the USB timing specifications


In Loader.h there are some additional defines relevant to the application that will be loaded (eg. encryption and start address) which you may also like to adjust based on the board/project but that is about all needed.

Good luck

Regards

Mark



Offline MU

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Getting Started With a Custom PCB
« Reply #2 on: March 15, 2019, 06:45:43 AM »
Thanks for the info. I have updated the code per your recommendations.

Am I going to run into any issues by defining the pin count as 80 and package type as LQFP as shown in the attachment? Just want to double-check on this before I go too far with the K60 setup. It doesn't appear to be a valid HW configuration, but I'm not sure if those dependencies are built into the serial loader code or not.

Thanks.

« Last Edit: March 15, 2019, 07:08:04 AM by MU »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Getting Started With a Custom PCB
« Reply #3 on: March 15, 2019, 03:56:35 PM »
Hi

The package type and pin count is mostly relevant only for the simulator (so that it displays the correct pin-outs and pin functions).
In a limited number of cases the package details may control a peripheral that may not may not exist in a certain part (eg. a K64 with 121 pins has 2 DACs but K64s with less that 121 pins only have 1 DAC)

Therefore it makes sense to match the setting to your actual part so that you potentially get an error or warning if you were to try to use something that doesn't exist (even if not critical in any way).

Regards

Mark