How to use SPIMASTER_LDD for MQX 4.0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use SPIMASTER_LDD for MQX 4.0

2,881 Views
venkateshgr
Contributor I

Hi All,

Am trying to use PE based SPI driver for MQX 4.0,

Following are the steps i have followed

1.Am using codewarrior 10.3 and added bsp_twrk60n512  to the project.

2.Added SPIMASTER_LDD component to processorExpert.pe

3. Done configuration settings for SPI and selected the ports.

4.Generated code for processorExpert.pe

Please guide me what are the furture steps to be done in order to use the PE based driver in MQX 4.0 rather than using the driver provided in peripherals IO's->spi

0 Kudos
Reply
11 Replies

2,547 Views
venkateshgr
Contributor I

Hi,

Can you please confirm if the PE LDD based generated code supports for multi threaded environment in MQX 4.0.0 or it supports only for baremetal?

GR.Venkatesh

0 Kudos
Reply

2,547 Views
venkateshgr
Contributor I

Hi,

Am in process of using the PE generated API's of UART. In case of the existing driver there are task handling in case of UART block read in serl_int.c file in the following API

_io_serial_int_read()

if(flags & IO_SERIAL_NON_BLOCKING) {

          if (_CHARQ_SIZE(in_queue) == 0) {

              num -= i;

              _int_enable();

              break;

          } /* Endif */

      } else {

          while (_CHARQ_SIZE(in_queue) == 0) {

            _taskq_suspend(int_io_dev_ptr->IN_WAITING_TASKS);

          } /* Endwhile */ 

      } /* Endif */


In case of the generated UART driver how to handle the tasks. In there any methods to be enebled during generating the code?


Am facing problem in executing the task from which the uart receive task is created.

0 Kudos
Reply

2,547 Views
venkateshgr
Contributor I

Hello,

I have already used the standard BSP drivers and working fine, now need to completely remove BSP drivers and use PE based drivers.

So you mean to say the existing io_read an ioctl's are compatible for non PE based only and not in case of using PE driver need to write wrappers and use on io_read write or directly use the PE driver APIs?

0 Kudos
Reply

2,547 Views
LuisCasado
NXP Employee
NXP Employee

Hi

BSP drivers are independent of PE LDD drivers. You have to use the PE methods directly in the same way you work with MQX Lite that doesn't have standard drivers. You don' t need ioread,open, ctl, etc

Luis

0 Kudos
Reply

2,547 Views
venkateshgr
Contributor I

Hi,

Ok thanks Luis. I never used MQX Lite. But i got the point from your previous reply that I need to use the generated API's from PE_LDD in place of all IOCTL calls to driver and open() and read write calls.

Am i right with my understanding?

GR.Venkatesh

0 Kudos
Reply

2,547 Views
LuisCasado
NXP Employee
NXP Employee

Hi,

Yes, correct. In the same way are used the LDD_xx in  C:\Freescale\Freescale_MQX_4_0\doc\tools\cw\FSL_MQX_in_CW_10_x.pdf

regards,

0 Kudos
Reply

2,547 Views
venkateshgr
Contributor I

Hi,

Thanks, I checked with that previously. Am trying to use generated Uart and SPI driver into Httpdsrv rtcs app. So wanted to know if calling the io_read() API will do the read from UART or do i need to use the API generated from PE in place of io_read() call.

0 Kudos
Reply

2,547 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

I would recommend to use the standard MQX BSP drivers by default (UART, SPI,..) In case you don't have a particular driver or particular functionality in the driver, to use LDD_xx driver with PE.

Check the MQXIOUG.pdf for driver functions and in the folder C:\Freescale\Freescale_MQX_4_0\mqx\examples you have examples of using MQX drivers (non PE). For example spi driver C:\Freescale\Freescale_MQX_4_0\mqx\examples\spi UART driver is used in many of those projects,

So you have two options, standard MQX driver or LDD_ PE driver, but you shouldn't mix them for a peripheral.

Luis

0 Kudos
Reply

2,547 Views
venkateshgr
Contributor I

Hi,

I have done with setting the methods and generating code for SPIMaster_LDD.

1. In order to initialize the driver do i need to call directly the Init() from generated code or by calling fopen or any other IOCTL?

2. Does the ioctl or fopen call internally calls the API's from generated code or do i need to use independently  the API's generated generated for example for read and write?

0 Kudos
Reply

2,547 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

Please, check the document : C:\Freescale\Freescale_MQX_4_0\doc\tools\cw\FSL_MQX_in_CW_10_x.pdf

You have examples of using LDD_xx driver.

Regards,

Luis


0 Kudos
Reply

2,547 Views
jch
NXP Employee
NXP Employee

Hi,

I think you are new user of the PE, so the next steps you need to do is just switch to the Methods tab select what methods you want to use. Generate the PE code. Then use the methods in your code. That's all. Any other questions?