Author Topic: Attempt to add the FreeMASTER 2.0 Driver to uTasker  (Read 2726 times)

Offline tdrobnak

  • Newbie
  • *
  • Posts: 28
    • View Profile
Attempt to add the FreeMASTER 2.0 Driver to uTasker
« on: September 11, 2019, 10:09:52 PM »
I know uTasker has optimized FreeMASTER support built into it, but I wanted to see if I could integrate the latest FreeMASTER driver that NXP supplies and use that with uTasker instead.  I was going to first start with a known working FreeMASTER communication driver (version 2.0) I have used in the past with FreeRTOS with uTasker, then move onto the latest 3.0 driver.

Installation
In order to use the FreeMASTER 2.0 driver, the present Freemaster.c file must be excluded from the build and definition FREEMASTER_UART must be defined.
Proceed with the following steps:
   1. Add the FreeMASTER 2.0 driver source code to the project.
      a. Include the necessary source code files and exclude the others.
   2. Add the include directories to the project.
   3. Modify the freemaster_cfg.h file as appropriate.
   4. Modify freemaster_serial.c
      a. Change FMSTR_Poll(void) to FMSTR_Poll(QUEUE_HANDLE FreemasterPortID, unsigned char ucInputMessage[])
      b. Change FMSTR_ProcessSCI(void) to FMSTR_ProcessSCI(QUEUE_HANDLE FreemasterPortID, usngined char ucInputMessage[])
         i. Disable direct serial register reads and writes in this function, use uTasker fnWrite() and fnRead() instead.
   5. Modify application.c
      a. Add an include to freemaster.h
      b. Comment out the while loop for fnHandleFreeMaster() and replace with FMSTR_Poll(FreemasterPortID,ucInputMessage) call.

Result
The uTasker application runs, but the FreeMASTER communication fails.  When FreeMASTER PC application version 2.5.13.0 is set for COM port and baud rate of uTasker FreeMASTER port, the communcation fails.

Any suggestions on what might be causing the board to not detect the PC connection?

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Attempt to add the FreeMASTER 2.0 Driver to uTasker
« Reply #1 on: September 11, 2019, 10:55:17 PM »
Hi

I haven't looked into newer Freemaster versions but when I integrated the original one I wrote the code from line 4563 and on (task, interface configurations and reception) and pasted in the original Freemaster code to the beginning of the file. This allowed it to all be maintained in a single file.
There may be a few smaller changes in the original pasted code but probably only to allow some more features - such as reading/writing SPI based memory and such.

Assuming that the protocol itself hasn't changed I would suggest taking the original file, making a copy of it and deleting all before line 4563. Then adding newer version source to it. It may also be necessary to extend the commands that are understood by the reception routine.

If versions 2 and 3 are extended commands it may also be possible to just add the extended reception command handling rather than have a new file.

This is written without knowing what the differences between V1, 2 and 3 are and under the assumption that the low level communication protocol is probably the same but the command set has been extended.

Regards

Mark