PWM pins on ls1021a

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

PWM pins on ls1021a

Jump to solution
1,888 Views
jiye
Contributor V

Hi,

I want to add RGB LEDs on my chip and wonder if ls1021a processor does support PWM pins configuration via software pinmux.

If so anyone knows how to set those pins as PWM and access it via software? 

My kernel version is Kernel 4.19 

1 Solution
1,701 Views
alexander_yakov
NXP Employee
NXP Employee

1. I meant you can look this driver source code to underdtand how to work with FTM block, to write your own FTM driver. Existing driver supports only wakeup function.

2. You do not need to config GPIO pins in device tree. To reconfigure IFC_A25 to FTM5_CH0 you have to modify RCW.

3. This depends on what you mean by "free to use". If you mean "exported" or "not exported", than you can always check this in Linux, but this information is not related to actual (physical) usage of the pin. If you mean, which pin is free to use physically, i.e. has nothing connected on the schematic and can be used for your needs, than - there is no way to determine it from Linux, this can be determined by reading the schematic.

View solution in original post

6 Replies
1,701 Views
alexander_yakov
NXP Employee
NXP Employee

PWM function is supported by "Flex Timer Module" (FTM) block. 

We do offer a driver for FTM module in our Linux SDK, but this driver supports only wakeup function to wakeup processor from deep sleep. However, you can look this driver code and use is as source to underdtand how to work with FTM block.

https://nxp.sdlproducts.com/LiveContent/content/en-US/LSDKUG_Rev19.09/GUID-BC131B90-BAD0-4082-962A-1...

PWM pins are multiplexed with other functions on device pins, and this multiplexing is configured in RCW settings. Please look LS1021A Reference Manual, Section 3.4.8 for details. 

0 Kudos
Reply
1,701 Views
jiye
Contributor V

By saying "PWM pins are multiplexed with other functions on device pins" do you mean we can use those pins as PWM exclusively or we cannot?

How about GPIO pins ? Can I export necessary gpio pins under /sys/class/gpio and use them as GPIO directly ?

0 Kudos
Reply
1,701 Views
alexander_yakov
NXP Employee
NXP Employee

Yes, you can use those pins exclusively for PWM function, but this function should be selected in RCW settings. 

GPIO pins are available, and you can export GPIO and than use it, but the GPIO block does not support PWM. 

0 Kudos
Reply
1,701 Views
jiye
Contributor V

1. "Yes, you can use those pins exclusively for PWM function, but this function should be selected in RCW settings. "   so in this case we can directly use the pin as PWM pins by setting the correct bit register in the RCW?  if so what do I need to change in the code. Under the FTM section of the document you sent me it shows an example of alarm timer.

-> Device Drivers                  
 -> Real Time Clock                                   
 -> <*> Freescale FlexTimer alarm timer

 

what is the right way to do for PWM?

 

2. Do I need to do something in the .config for GPIO pins while building the kernel. or .dtb file. If so I would appreciate any instructions.  Besides, when I check the section

3.4.8 IFC, SPI, QuadSPI, I 2 C, FTM, and GPIO2   signal multiplexing does this mean the pin can switch from PWM to GPIO or vice versa ?

pastedImage_2.png

IFC_A25 as an example

what pins only have GPIO functionalities?

0 Kudos
Reply
1,701 Views
jiye
Contributor V

(3) How to check which GPIOs are free to use at this moment. Are they referred by GPIO3_10 for example or gpio67 as in /sys/class/gpio  they always export as gpio67 manner where to find all these information thanks. I checked the reference manual I only see

pastedImage_1.png

what is the correspondent gpio numbers in the linux user space

0 Kudos
Reply
1,702 Views
alexander_yakov
NXP Employee
NXP Employee

1. I meant you can look this driver source code to underdtand how to work with FTM block, to write your own FTM driver. Existing driver supports only wakeup function.

2. You do not need to config GPIO pins in device tree. To reconfigure IFC_A25 to FTM5_CH0 you have to modify RCW.

3. This depends on what you mean by "free to use". If you mean "exported" or "not exported", than you can always check this in Linux, but this information is not related to actual (physical) usage of the pin. If you mean, which pin is free to use physically, i.e. has nothing connected on the schematic and can be used for your needs, than - there is no way to determine it from Linux, this can be determined by reading the schematic.