Help with PWM on LPC2468

classic Classic list List threaded Threaded
15 messages Options
Ives Cunha Ives Cunha
Reply | Threaded
Open this post in threaded view
|

Help with PWM on LPC2468

Hi,
I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board( LPC2468 ), but at the exit pin I only see a DC level.
This is what I am doing:

pwm.setclock( 0, 12000000 )
pwm.setup( 0, 5000, 90 )
pwm.start( 0 )

pwm.setup( 1, 5000, 30 )
pwm.start( 1 )

Am I missing something here?

Thanks,
Ives 
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

Hi,

Thanks for the report, I'll take a look at it.

Best,
Bogdan

On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]> wrote:

> Hi,
> I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board( LPC2468 ),
> but at the exit pin I only see a DC level.
> This is what I am doing:
>
> pwm.setclock( 0, 12000000 )
> pwm.setup( 0, 5000, 90 )
> pwm.start( 0 )
>
> pwm.setup( 1, 5000, 30 )
> pwm.start( 1 )
>
> Am I missing something here?
>
> Thanks,
> Ives
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Ives Cunha Ives Cunha
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

Hi,
    I just tried some more things with no good result, so I gonna report my tests for you know better what is happening.
   At first I tested this code on EKLM3S8962 and it worked.

  pwm.setclock( 0, 12000000 )
  pwm.setup( 0, 5000, 90 )
  pwm.start( 0 )
  pwm.setup( 1, 5000, 10 )
  pwm.start( 1 )
 
so I tried it on eLua Demo Board and again my exit signal was a 2.8V DC.
I turned on all PWM on Demo board, and saw all the pins that have PWM function, and again the exit was a 2.8V DC.
Then I tryed to use I/O function on some of this pins to see if there were any connection problem, and all the pins worked properly.
I have a deadline of a week, is possible to solve this til then?
Could someone else test this function on LPC?

Thanks again
Ives

2010/7/27 Bogdan Marinescu <[hidden email]>
Hi,

Thanks for the report, I'll take a look at it.

Best,
Bogdan

On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]> wrote:
> Hi,
> I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board( LPC2468 ),
> but at the exit pin I only see a DC level.
> This is what I am doing:
>
> pwm.setclock( 0, 12000000 )
> pwm.setup( 0, 5000, 90 )
> pwm.start( 0 )
>
> pwm.setup( 1, 5000, 30 )
> pwm.start( 1 )
>
> Am I missing something here?
>
> Thanks,
> Ives
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

One thing that may or may not have been brought up yet is that this
platform requires pins to be configured for certain outputs to work.
I'm not sure what the defaults are on this board, but you may need to
set the contents of some PINSEL registers.

pwmled.lua does this:
elseif pd.board() == 'ELUA-PUC' then
  pwmid, tmrid = 7, 0
  local psel = cpu.r32( cpu.IO_PINSEL3 )
  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
  cpu.w32( cpu.IO_PINSEL3, psel )

It likely wouldn't be too hard to have a wrapper function that does
this, similar to the mbed one, since the configuration models are
almost the same for these platforms.

The PINSEL register descriptions should be in the LPC2468 manual.

On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]> wrote:

> Hi,
>     I just tried some more things with no good result, so I gonna report my
> tests for you know better what is happening.
>    At first I tested this code on EKLM3S8962 and it worked.
>
>   pwm.setclock( 0, 12000000 )
>   pwm.setup( 0, 5000, 90 )
>   pwm.start( 0 )
>   pwm.setup( 1, 5000, 10 )
>   pwm.start( 1 )
>
> so I tried it on eLua Demo Board and again my exit signal was a 2.8V DC.
> I turned on all PWM on Demo board, and saw all the pins that have PWM
> function, and again the exit was a 2.8V DC.
> Then I tryed to use I/O function on some of this pins to see if there were
> any connection problem, and all the pins worked properly.
> I have a deadline of a week, is possible to solve this til then?
> Could someone else test this function on LPC?
>
> Thanks again
> Ives
>
> 2010/7/27 Bogdan Marinescu <[hidden email]>
>>
>> Hi,
>>
>> Thanks for the report, I'll take a look at it.
>>
>> Best,
>> Bogdan
>>
>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]> wrote:
>> > Hi,
>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board( LPC2468
>> > ),
>> > but at the exit pin I only see a DC level.
>> > This is what I am doing:
>> >
>> > pwm.setclock( 0, 12000000 )
>> > pwm.setup( 0, 5000, 90 )
>> > pwm.start( 0 )
>> >
>> > pwm.setup( 1, 5000, 30 )
>> > pwm.start( 1 )
>> >
>> > Am I missing something here?
>> >
>> > Thanks,
>> > Ives
>> > _______________________________________________
>> > eLua-dev mailing list
>> > [hidden email]
>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

On Wed, Aug 4, 2010 at 12:07 AM, James Snyder <[hidden email]> wrote:

> One thing that may or may not have been brought up yet is that this
> platform requires pins to be configured for certain outputs to work.
> I'm not sure what the defaults are on this board, but you may need to
> set the contents of some PINSEL registers.
>
> pwmled.lua does this:
> elseif pd.board() == 'ELUA-PUC' then
>  pwmid, tmrid = 7, 0
>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>  cpu.w32( cpu.IO_PINSEL3, psel )
>
> It likely wouldn't be too hard to have a wrapper function that does
> this, similar to the mbed one, since the configuration models are
> almost the same for these platforms.
>
> The PINSEL register descriptions should be in the LPC2468 manual.

Thanks James, that's probably the problem. I'll try to fix it in SVN
tonight, although your solution provides a nice workaround directly in
eLua.


Best,
Bogdan

>
> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]> wrote:
>> Hi,
>>     I just tried some more things with no good result, so I gonna report my
>> tests for you know better what is happening.
>>    At first I tested this code on EKLM3S8962 and it worked.
>>
>>   pwm.setclock( 0, 12000000 )
>>   pwm.setup( 0, 5000, 90 )
>>   pwm.start( 0 )
>>   pwm.setup( 1, 5000, 10 )
>>   pwm.start( 1 )
>>
>> so I tried it on eLua Demo Board and again my exit signal was a 2.8V DC.
>> I turned on all PWM on Demo board, and saw all the pins that have PWM
>> function, and again the exit was a 2.8V DC.
>> Then I tryed to use I/O function on some of this pins to see if there were
>> any connection problem, and all the pins worked properly.
>> I have a deadline of a week, is possible to solve this til then?
>> Could someone else test this function on LPC?
>>
>> Thanks again
>> Ives
>>
>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>>>
>>> Hi,
>>>
>>> Thanks for the report, I'll take a look at it.
>>>
>>> Best,
>>> Bogdan
>>>
>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]> wrote:
>>> > Hi,
>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board( LPC2468
>>> > ),
>>> > but at the exit pin I only see a DC level.
>>> > This is what I am doing:
>>> >
>>> > pwm.setclock( 0, 12000000 )
>>> > pwm.setup( 0, 5000, 90 )
>>> > pwm.start( 0 )
>>> >
>>> > pwm.setup( 1, 5000, 30 )
>>> > pwm.start( 1 )
>>> >
>>> > Am I missing something here?
>>> >
>>> > Thanks,
>>> > Ives
>>> > _______________________________________________
>>> > eLua-dev mailing list
>>> > [hidden email]
>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >
>>> >
>>> _______________________________________________
>>> eLua-dev mailing list
>>> [hidden email]
>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>>
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>>
>
>
>
> --
> James Snyder
> Biomedical Engineering
> Northwestern University
> [hidden email]
> PGP: http://fanplastic.org/key.txt
> Phone: (847) 448-0386
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
<[hidden email]> wrote:

> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder <[hidden email]> wrote:
>> One thing that may or may not have been brought up yet is that this
>> platform requires pins to be configured for certain outputs to work.
>> I'm not sure what the defaults are on this board, but you may need to
>> set the contents of some PINSEL registers.
>>
>> pwmled.lua does this:
>> elseif pd.board() == 'ELUA-PUC' then
>>  pwmid, tmrid = 7, 0
>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>>  cpu.w32( cpu.IO_PINSEL3, psel )
>>
>> It likely wouldn't be too hard to have a wrapper function that does
>> this, similar to the mbed one, since the configuration models are
>> almost the same for these platforms.
>>
>> The PINSEL register descriptions should be in the LPC2468 manual.
>
> Thanks James, that's probably the problem. I'll try to fix it in SVN
> tonight, although your solution provides a nice workaround directly in
> eLua.

Actually, I'll probably not try to fix it directly in SVN, since the
I/O configuration of the LPC2468 allows multiple pins as outputs for
the same PWM channel. As I don't know what pins Ives is trying to use,
probably the best method for him is to use the method above, tailored
to his specific needs. Datasheet to the rescue! :)

Best,
Bogdan

>>
>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]> wrote:
>>> Hi,
>>>     I just tried some more things with no good result, so I gonna report my
>>> tests for you know better what is happening.
>>>    At first I tested this code on EKLM3S8962 and it worked.
>>>
>>>   pwm.setclock( 0, 12000000 )
>>>   pwm.setup( 0, 5000, 90 )
>>>   pwm.start( 0 )
>>>   pwm.setup( 1, 5000, 10 )
>>>   pwm.start( 1 )
>>>
>>> so I tried it on eLua Demo Board and again my exit signal was a 2.8V DC.
>>> I turned on all PWM on Demo board, and saw all the pins that have PWM
>>> function, and again the exit was a 2.8V DC.
>>> Then I tryed to use I/O function on some of this pins to see if there were
>>> any connection problem, and all the pins worked properly.
>>> I have a deadline of a week, is possible to solve this til then?
>>> Could someone else test this function on LPC?
>>>
>>> Thanks again
>>> Ives
>>>
>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>>>>
>>>> Hi,
>>>>
>>>> Thanks for the report, I'll take a look at it.
>>>>
>>>> Best,
>>>> Bogdan
>>>>
>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]> wrote:
>>>> > Hi,
>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board( LPC2468
>>>> > ),
>>>> > but at the exit pin I only see a DC level.
>>>> > This is what I am doing:
>>>> >
>>>> > pwm.setclock( 0, 12000000 )
>>>> > pwm.setup( 0, 5000, 90 )
>>>> > pwm.start( 0 )
>>>> >
>>>> > pwm.setup( 1, 5000, 30 )
>>>> > pwm.start( 1 )
>>>> >
>>>> > Am I missing something here?
>>>> >
>>>> > Thanks,
>>>> > Ives
>>>> > _______________________________________________
>>>> > eLua-dev mailing list
>>>> > [hidden email]
>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>>> >
>>>> >
>>>> _______________________________________________
>>>> eLua-dev mailing list
>>>> [hidden email]
>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>
>>>
>>> _______________________________________________
>>> eLua-dev mailing list
>>> [hidden email]
>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>
>>>
>>
>>
>>
>> --
>> James Snyder
>> Biomedical Engineering
>> Northwestern University
>> [hidden email]
>> PGP: http://fanplastic.org/key.txt
>> Phone: (847) 448-0386
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

Yep.  I'm currently following a policy of configuring these sorts of
things automatically if there's only one pin that can be used for a
configuration.

I think what would be nice is for platform.c to have data on usable
pin mappings for various peripherals that are supported, and if the
user asks to set up the peripheral by referring to a pin rather than
the device id, it will attempt to set up the pin for that use.
Admittedly there may currently be some scenarios where if something
like CAN is set up on STM32 there may not be a way to revert the pin
to default behavior without a reset (though I would have to check).

On Tue, Aug 3, 2010 at 4:22 PM, Bogdan Marinescu
<[hidden email]> wrote:

> On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
> <[hidden email]> wrote:
>> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder <[hidden email]> wrote:
>>> One thing that may or may not have been brought up yet is that this
>>> platform requires pins to be configured for certain outputs to work.
>>> I'm not sure what the defaults are on this board, but you may need to
>>> set the contents of some PINSEL registers.
>>>
>>> pwmled.lua does this:
>>> elseif pd.board() == 'ELUA-PUC' then
>>>  pwmid, tmrid = 7, 0
>>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>>>  cpu.w32( cpu.IO_PINSEL3, psel )
>>>
>>> It likely wouldn't be too hard to have a wrapper function that does
>>> this, similar to the mbed one, since the configuration models are
>>> almost the same for these platforms.
>>>
>>> The PINSEL register descriptions should be in the LPC2468 manual.
>>
>> Thanks James, that's probably the problem. I'll try to fix it in SVN
>> tonight, although your solution provides a nice workaround directly in
>> eLua.
>
> Actually, I'll probably not try to fix it directly in SVN, since the
> I/O configuration of the LPC2468 allows multiple pins as outputs for
> the same PWM channel. As I don't know what pins Ives is trying to use,
> probably the best method for him is to use the method above, tailored
> to his specific needs. Datasheet to the rescue! :)
>
> Best,
> Bogdan
>>>
>>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]> wrote:
>>>> Hi,
>>>>     I just tried some more things with no good result, so I gonna report my
>>>> tests for you know better what is happening.
>>>>    At first I tested this code on EKLM3S8962 and it worked.
>>>>
>>>>   pwm.setclock( 0, 12000000 )
>>>>   pwm.setup( 0, 5000, 90 )
>>>>   pwm.start( 0 )
>>>>   pwm.setup( 1, 5000, 10 )
>>>>   pwm.start( 1 )
>>>>
>>>> so I tried it on eLua Demo Board and again my exit signal was a 2.8V DC.
>>>> I turned on all PWM on Demo board, and saw all the pins that have PWM
>>>> function, and again the exit was a 2.8V DC.
>>>> Then I tryed to use I/O function on some of this pins to see if there were
>>>> any connection problem, and all the pins worked properly.
>>>> I have a deadline of a week, is possible to solve this til then?
>>>> Could someone else test this function on LPC?
>>>>
>>>> Thanks again
>>>> Ives
>>>>
>>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>>>>>
>>>>> Hi,
>>>>>
>>>>> Thanks for the report, I'll take a look at it.
>>>>>
>>>>> Best,
>>>>> Bogdan
>>>>>
>>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]> wrote:
>>>>> > Hi,
>>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board( LPC2468
>>>>> > ),
>>>>> > but at the exit pin I only see a DC level.
>>>>> > This is what I am doing:
>>>>> >
>>>>> > pwm.setclock( 0, 12000000 )
>>>>> > pwm.setup( 0, 5000, 90 )
>>>>> > pwm.start( 0 )
>>>>> >
>>>>> > pwm.setup( 1, 5000, 30 )
>>>>> > pwm.start( 1 )
>>>>> >
>>>>> > Am I missing something here?
>>>>> >
>>>>> > Thanks,
>>>>> > Ives
>>>>> > _______________________________________________
>>>>> > eLua-dev mailing list
>>>>> > [hidden email]
>>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>>>> >
>>>>> >
>>>>> _______________________________________________
>>>>> eLua-dev mailing list
>>>>> [hidden email]
>>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>>
>>>>
>>>> _______________________________________________
>>>> eLua-dev mailing list
>>>> [hidden email]
>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> James Snyder
>>> Biomedical Engineering
>>> Northwestern University
>>> [hidden email]
>>> PGP: http://fanplastic.org/key.txt
>>> Phone: (847) 448-0386
>>> _______________________________________________
>>> eLua-dev mailing list
>>> [hidden email]
>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>
>>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Ives Cunha Ives Cunha
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

Hi.
     Thank to you I could fiinally make it work, but the function cpu.w32 only worked when I used hexadecimal address.
     Is something wrong with platform_conf?


Thanks again
Ives

2010/8/4 James Snyder <[hidden email]>
Yep.  I'm currently following a policy of configuring these sorts of
things automatically if there's only one pin that can be used for a
configuration.

I think what would be nice is for platform.c to have data on usable
pin mappings for various peripherals that are supported, and if the
user asks to set up the peripheral by referring to a pin rather than
the device id, it will attempt to set up the pin for that use.
Admittedly there may currently be some scenarios where if something
like CAN is set up on STM32 there may not be a way to revert the pin
to default behavior without a reset (though I would have to check).

On Tue, Aug 3, 2010 at 4:22 PM, Bogdan Marinescu
<[hidden email]> wrote:
> On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
> <[hidden email]> wrote:
>> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder <[hidden email]> wrote:
>>> One thing that may or may not have been brought up yet is that this
>>> platform requires pins to be configured for certain outputs to work.
>>> I'm not sure what the defaults are on this board, but you may need to
>>> set the contents of some PINSEL registers.
>>>
>>> pwmled.lua does this:
>>> elseif pd.board() == 'ELUA-PUC' then
>>>  pwmid, tmrid = 7, 0
>>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>>>  cpu.w32( cpu.IO_PINSEL3, psel )
>>>
>>> It likely wouldn't be too hard to have a wrapper function that does
>>> this, similar to the mbed one, since the configuration models are
>>> almost the same for these platforms.
>>>
>>> The PINSEL register descriptions should be in the LPC2468 manual.
>>
>> Thanks James, that's probably the problem. I'll try to fix it in SVN
>> tonight, although your solution provides a nice workaround directly in
>> eLua.
>
> Actually, I'll probably not try to fix it directly in SVN, since the
> I/O configuration of the LPC2468 allows multiple pins as outputs for
> the same PWM channel. As I don't know what pins Ives is trying to use,
> probably the best method for him is to use the method above, tailored
> to his specific needs. Datasheet to the rescue! :)
>
> Best,
> Bogdan
>>>
>>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]> wrote:
>>>> Hi,
>>>>     I just tried some more things with no good result, so I gonna report my
>>>> tests for you know better what is happening.
>>>>    At first I tested this code on EKLM3S8962 and it worked.
>>>>
>>>>   pwm.setclock( 0, 12000000 )
>>>>   pwm.setup( 0, 5000, 90 )
>>>>   pwm.start( 0 )
>>>>   pwm.setup( 1, 5000, 10 )
>>>>   pwm.start( 1 )
>>>>
>>>> so I tried it on eLua Demo Board and again my exit signal was a 2.8V DC.
>>>> I turned on all PWM on Demo board, and saw all the pins that have PWM
>>>> function, and again the exit was a 2.8V DC.
>>>> Then I tryed to use I/O function on some of this pins to see if there were
>>>> any connection problem, and all the pins worked properly.
>>>> I have a deadline of a week, is possible to solve this til then?
>>>> Could someone else test this function on LPC?
>>>>
>>>> Thanks again
>>>> Ives
>>>>
>>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>>>>>
>>>>> Hi,
>>>>>
>>>>> Thanks for the report, I'll take a look at it.
>>>>>
>>>>> Best,
>>>>> Bogdan
>>>>>
>>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]> wrote:
>>>>> > Hi,
>>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board( LPC2468
>>>>> > ),
>>>>> > but at the exit pin I only see a DC level.
>>>>> > This is what I am doing:
>>>>> >
>>>>> > pwm.setclock( 0, 12000000 )
>>>>> > pwm.setup( 0, 5000, 90 )
>>>>> > pwm.start( 0 )
>>>>> >
>>>>> > pwm.setup( 1, 5000, 30 )
>>>>> > pwm.start( 1 )
>>>>> >
>>>>> > Am I missing something here?
>>>>> >
>>>>> > Thanks,
>>>>> > Ives
>>>>> > _______________________________________________
>>>>> > eLua-dev mailing list
>>>>> > [hidden email]
>>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>>>> >
>>>>> >
>>>>> _______________________________________________
>>>>> eLua-dev mailing list
>>>>> [hidden email]
>>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>>
>>>>
>>>> _______________________________________________
>>>> eLua-dev mailing list
>>>> [hidden email]
>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> James Snyder
>>> Biomedical Engineering
>>> Northwestern University
>>> [hidden email]
>>> PGP: http://fanplastic.org/key.txt
>>> Phone: (847) 448-0386
>>> _______________________________________________
>>> eLua-dev mailing list
>>> [hidden email]
>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>>
>>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

On Thu, Aug 5, 2010 at 12:42 AM, Ives Cunha <[hidden email]> wrote:
> Hi.
>      Thank to you I could fiinally make it work, but the function cpu.w32
> only worked when I used hexadecimal address.
>      Is something wrong with platform_conf?

It's not wrong, just incomplete. You need to list all the constants
that you need to expose via the CPU module yourself:

http://www.eluaproject.net/en_refman_gen_cpu.html#cpu_constants

Best,
Bogdan

> 2010/8/4 James Snyder <[hidden email]>
>>
>> Yep.  I'm currently following a policy of configuring these sorts of
>> things automatically if there's only one pin that can be used for a
>> configuration.
>>
>> I think what would be nice is for platform.c to have data on usable
>> pin mappings for various peripherals that are supported, and if the
>> user asks to set up the peripheral by referring to a pin rather than
>> the device id, it will attempt to set up the pin for that use.
>> Admittedly there may currently be some scenarios where if something
>> like CAN is set up on STM32 there may not be a way to revert the pin
>> to default behavior without a reset (though I would have to check).
>>
>> On Tue, Aug 3, 2010 at 4:22 PM, Bogdan Marinescu
>> <[hidden email]> wrote:
>> > On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
>> > <[hidden email]> wrote:
>> >> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder <[hidden email]>
>> >> wrote:
>> >>> One thing that may or may not have been brought up yet is that this
>> >>> platform requires pins to be configured for certain outputs to work.
>> >>> I'm not sure what the defaults are on this board, but you may need to
>> >>> set the contents of some PINSEL registers.
>> >>>
>> >>> pwmled.lua does this:
>> >>> elseif pd.board() == 'ELUA-PUC' then
>> >>>  pwmid, tmrid = 7, 0
>> >>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>> >>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>> >>>  cpu.w32( cpu.IO_PINSEL3, psel )
>> >>>
>> >>> It likely wouldn't be too hard to have a wrapper function that does
>> >>> this, similar to the mbed one, since the configuration models are
>> >>> almost the same for these platforms.
>> >>>
>> >>> The PINSEL register descriptions should be in the LPC2468 manual.
>> >>
>> >> Thanks James, that's probably the problem. I'll try to fix it in SVN
>> >> tonight, although your solution provides a nice workaround directly in
>> >> eLua.
>> >
>> > Actually, I'll probably not try to fix it directly in SVN, since the
>> > I/O configuration of the LPC2468 allows multiple pins as outputs for
>> > the same PWM channel. As I don't know what pins Ives is trying to use,
>> > probably the best method for him is to use the method above, tailored
>> > to his specific needs. Datasheet to the rescue! :)
>> >
>> > Best,
>> > Bogdan
>> >>>
>> >>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]> wrote:
>> >>>> Hi,
>> >>>>     I just tried some more things with no good result, so I gonna
>> >>>> report my
>> >>>> tests for you know better what is happening.
>> >>>>    At first I tested this code on EKLM3S8962 and it worked.
>> >>>>
>> >>>>   pwm.setclock( 0, 12000000 )
>> >>>>   pwm.setup( 0, 5000, 90 )
>> >>>>   pwm.start( 0 )
>> >>>>   pwm.setup( 1, 5000, 10 )
>> >>>>   pwm.start( 1 )
>> >>>>
>> >>>> so I tried it on eLua Demo Board and again my exit signal was a 2.8V
>> >>>> DC.
>> >>>> I turned on all PWM on Demo board, and saw all the pins that have PWM
>> >>>> function, and again the exit was a 2.8V DC.
>> >>>> Then I tryed to use I/O function on some of this pins to see if there
>> >>>> were
>> >>>> any connection problem, and all the pins worked properly.
>> >>>> I have a deadline of a week, is possible to solve this til then?
>> >>>> Could someone else test this function on LPC?
>> >>>>
>> >>>> Thanks again
>> >>>> Ives
>> >>>>
>> >>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>> >>>>>
>> >>>>> Hi,
>> >>>>>
>> >>>>> Thanks for the report, I'll take a look at it.
>> >>>>>
>> >>>>> Best,
>> >>>>> Bogdan
>> >>>>>
>> >>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]>
>> >>>>> wrote:
>> >>>>> > Hi,
>> >>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board(
>> >>>>> > LPC2468
>> >>>>> > ),
>> >>>>> > but at the exit pin I only see a DC level.
>> >>>>> > This is what I am doing:
>> >>>>> >
>> >>>>> > pwm.setclock( 0, 12000000 )
>> >>>>> > pwm.setup( 0, 5000, 90 )
>> >>>>> > pwm.start( 0 )
>> >>>>> >
>> >>>>> > pwm.setup( 1, 5000, 30 )
>> >>>>> > pwm.start( 1 )
>> >>>>> >
>> >>>>> > Am I missing something here?
>> >>>>> >
>> >>>>> > Thanks,
>> >>>>> > Ives
>> >>>>> > _______________________________________________
>> >>>>> > eLua-dev mailing list
>> >>>>> > [hidden email]
>> >>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >>>>> >
>> >>>>> >
>> >>>>> _______________________________________________
>> >>>>> eLua-dev mailing list
>> >>>>> [hidden email]
>> >>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >>>>
>> >>>>
>> >>>> _______________________________________________
>> >>>> eLua-dev mailing list
>> >>>> [hidden email]
>> >>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> James Snyder
>> >>> Biomedical Engineering
>> >>> Northwestern University
>> >>> [hidden email]
>> >>> PGP: http://fanplastic.org/key.txt
>> >>> Phone: (847) 448-0386
>> >>> _______________________________________________
>> >>> eLua-dev mailing list
>> >>> [hidden email]
>> >>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >>>
>> >>
>> > _______________________________________________
>> > eLua-dev mailing list
>> > [hidden email]
>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>>
>>
>>
>> --
>> James Snyder
>> Biomedical Engineering
>> Northwestern University
>> [hidden email]
>> PGP: http://fanplastic.org/key.txt
>> Phone: (847) 448-0386
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Ives Cunha Ives Cunha
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

I have this on my platform_conf:
#define PINSEL_BASE_ADDR 0xE002C000
#define IO_PINSEL0           ( PINSEL_BASE_ADDR + 0x00 )
#define IO_PINSEL1           ( PINSEL_BASE_ADDR + 0x04 )
#define IO_PINSEL2           ( PINSEL_BASE_ADDR + 0x08 )
#define IO_PINSEL3           ( PINSEL_BASE_ADDR + 0x0C )
#define IO_PINSEL4           ( PINSEL_BASE_ADDR + 0x10 )
#define IO_PINSEL5           ( PINSEL_BASE_ADDR + 0x14 )
#define IO_PINSEL6           ( PINSEL_BASE_ADDR + 0x18 )
#define IO_PINSEL7           ( PINSEL_BASE_ADDR + 0x1C )
#define IO_PINSEL8           ( PINSEL_BASE_ADDR + 0x20 )
#define IO_PINSEL9           ( PINSEL_BASE_ADDR + 0x24 )
#define IO_PINSEL10         ( PINSEL_BASE_ADDR + 0x28 )

#define PLATFORM_CPU_CONSTANTS\
 _C( IO_PINSEL0 ),\
 _C( IO_PINSEL1 ),\
 _C( IO_PINSEL2 ),\
 _C( IO_PINSEL3 ),\
 _C( IO_PINSEL4 ),\
 _C( IO_PINSEL5 ),\
 _C( IO_PINSEL6 ),\
 _C( IO_PINSEL7 ),\
 _C( IO_PINSEL8 ),\
 _C( IO_PINSEL9 ),\
 _C( IO_PINSEL10 )

Do I have to do something more?

2010/8/4 Bogdan Marinescu <[hidden email]>
On Thu, Aug 5, 2010 at 12:42 AM, Ives Cunha <[hidden email]> wrote:
> Hi.
>      Thank to you I could fiinally make it work, but the function cpu.w32
> only worked when I used hexadecimal address.
>      Is something wrong with platform_conf?

It's not wrong, just incomplete. You need to list all the constants
that you need to expose via the CPU module yourself:

http://www.eluaproject.net/en_refman_gen_cpu.html#cpu_constants

Best,
Bogdan

> 2010/8/4 James Snyder <[hidden email]>
>>
>> Yep.  I'm currently following a policy of configuring these sorts of
>> things automatically if there's only one pin that can be used for a
>> configuration.
>>
>> I think what would be nice is for platform.c to have data on usable
>> pin mappings for various peripherals that are supported, and if the
>> user asks to set up the peripheral by referring to a pin rather than
>> the device id, it will attempt to set up the pin for that use.
>> Admittedly there may currently be some scenarios where if something
>> like CAN is set up on STM32 there may not be a way to revert the pin
>> to default behavior without a reset (though I would have to check).
>>
>> On Tue, Aug 3, 2010 at 4:22 PM, Bogdan Marinescu
>> <[hidden email]> wrote:
>> > On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
>> > <[hidden email]> wrote:
>> >> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder <[hidden email]>
>> >> wrote:
>> >>> One thing that may or may not have been brought up yet is that this
>> >>> platform requires pins to be configured for certain outputs to work.
>> >>> I'm not sure what the defaults are on this board, but you may need to
>> >>> set the contents of some PINSEL registers.
>> >>>
>> >>> pwmled.lua does this:
>> >>> elseif pd.board() == 'ELUA-PUC' then
>> >>>  pwmid, tmrid = 7, 0
>> >>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>> >>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>> >>>  cpu.w32( cpu.IO_PINSEL3, psel )
>> >>>
>> >>> It likely wouldn't be too hard to have a wrapper function that does
>> >>> this, similar to the mbed one, since the configuration models are
>> >>> almost the same for these platforms.
>> >>>
>> >>> The PINSEL register descriptions should be in the LPC2468 manual.
>> >>
>> >> Thanks James, that's probably the problem. I'll try to fix it in SVN
>> >> tonight, although your solution provides a nice workaround directly in
>> >> eLua.
>> >
>> > Actually, I'll probably not try to fix it directly in SVN, since the
>> > I/O configuration of the LPC2468 allows multiple pins as outputs for
>> > the same PWM channel. As I don't know what pins Ives is trying to use,
>> > probably the best method for him is to use the method above, tailored
>> > to his specific needs. Datasheet to the rescue! :)
>> >
>> > Best,
>> > Bogdan
>> >>>
>> >>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]> wrote:
>> >>>> Hi,
>> >>>>     I just tried some more things with no good result, so I gonna
>> >>>> report my
>> >>>> tests for you know better what is happening.
>> >>>>    At first I tested this code on EKLM3S8962 and it worked.
>> >>>>
>> >>>>   pwm.setclock( 0, 12000000 )
>> >>>>   pwm.setup( 0, 5000, 90 )
>> >>>>   pwm.start( 0 )
>> >>>>   pwm.setup( 1, 5000, 10 )
>> >>>>   pwm.start( 1 )
>> >>>>
>> >>>> so I tried it on eLua Demo Board and again my exit signal was a 2.8V
>> >>>> DC.
>> >>>> I turned on all PWM on Demo board, and saw all the pins that have PWM
>> >>>> function, and again the exit was a 2.8V DC.
>> >>>> Then I tryed to use I/O function on some of this pins to see if there
>> >>>> were
>> >>>> any connection problem, and all the pins worked properly.
>> >>>> I have a deadline of a week, is possible to solve this til then?
>> >>>> Could someone else test this function on LPC?
>> >>>>
>> >>>> Thanks again
>> >>>> Ives
>> >>>>
>> >>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>> >>>>>
>> >>>>> Hi,
>> >>>>>
>> >>>>> Thanks for the report, I'll take a look at it.
>> >>>>>
>> >>>>> Best,
>> >>>>> Bogdan
>> >>>>>
>> >>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]>
>> >>>>> wrote:
>> >>>>> > Hi,
>> >>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board(
>> >>>>> > LPC2468
>> >>>>> > ),
>> >>>>> > but at the exit pin I only see a DC level.
>> >>>>> > This is what I am doing:
>> >>>>> >
>> >>>>> > pwm.setclock( 0, 12000000 )
>> >>>>> > pwm.setup( 0, 5000, 90 )
>> >>>>> > pwm.start( 0 )
>> >>>>> >
>> >>>>> > pwm.setup( 1, 5000, 30 )
>> >>>>> > pwm.start( 1 )
>> >>>>> >
>> >>>>> > Am I missing something here?
>> >>>>> >
>> >>>>> > Thanks,
>> >>>>> > Ives
>> >>>>> > _______________________________________________
>> >>>>> > eLua-dev mailing list
>> >>>>> > [hidden email]
>> >>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >>>>> >
>> >>>>> >
>> >>>>> _______________________________________________
>> >>>>> eLua-dev mailing list
>> >>>>> [hidden email]
>> >>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >>>>
>> >>>>
>> >>>> _______________________________________________
>> >>>> eLua-dev mailing list
>> >>>> [hidden email]
>> >>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> James Snyder
>> >>> Biomedical Engineering
>> >>> Northwestern University
>> >>> [hidden email]
>> >>> PGP: http://fanplastic.org/key.txt
>> >>> Phone: (847) 448-0386
>> >>> _______________________________________________
>> >>> eLua-dev mailing list
>> >>> [hidden email]
>> >>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >>>
>> >>
>> > _______________________________________________
>> > eLua-dev mailing list
>> > [hidden email]
>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>>
>>
>>
>> --
>> James Snyder
>> Biomedical Engineering
>> Northwestern University
>> [hidden email]
>> PGP: http://fanplastic.org/key.txt
>> Phone: (847) 448-0386
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

On Thu, Aug 5, 2010 at 1:06 AM, Ives Cunha <[hidden email]> wrote:

> I have this on my platform_conf:
> #define PINSEL_BASE_ADDR 0xE002C000
> #define IO_PINSEL0           ( PINSEL_BASE_ADDR + 0x00 )
> #define IO_PINSEL1           ( PINSEL_BASE_ADDR + 0x04 )
> #define IO_PINSEL2           ( PINSEL_BASE_ADDR + 0x08 )
> #define IO_PINSEL3           ( PINSEL_BASE_ADDR + 0x0C )
> #define IO_PINSEL4           ( PINSEL_BASE_ADDR + 0x10 )
> #define IO_PINSEL5           ( PINSEL_BASE_ADDR + 0x14 )
> #define IO_PINSEL6           ( PINSEL_BASE_ADDR + 0x18 )
> #define IO_PINSEL7           ( PINSEL_BASE_ADDR + 0x1C )
> #define IO_PINSEL8           ( PINSEL_BASE_ADDR + 0x20 )
> #define IO_PINSEL9           ( PINSEL_BASE_ADDR + 0x24 )
> #define IO_PINSEL10         ( PINSEL_BASE_ADDR + 0x28 )
>
> #define PLATFORM_CPU_CONSTANTS\
>  _C( IO_PINSEL0 ),\
>  _C( IO_PINSEL1 ),\
>  _C( IO_PINSEL2 ),\
>  _C( IO_PINSEL3 ),\
>  _C( IO_PINSEL4 ),\
>  _C( IO_PINSEL5 ),\
>  _C( IO_PINSEL6 ),\
>  _C( IO_PINSEL7 ),\
>  _C( IO_PINSEL8 ),\
>  _C( IO_PINSEL9 ),\
>  _C( IO_PINSEL10 )
>
> Do I have to do something more?

What is the output of print(cpu.IO_PINSEL0) ?

Best,
Bogdan

> 2010/8/4 Bogdan Marinescu <[hidden email]>
>>
>> On Thu, Aug 5, 2010 at 12:42 AM, Ives Cunha <[hidden email]> wrote:
>> > Hi.
>> >      Thank to you I could fiinally make it work, but the function
>> > cpu.w32
>> > only worked when I used hexadecimal address.
>> >      Is something wrong with platform_conf?
>>
>> It's not wrong, just incomplete. You need to list all the constants
>> that you need to expose via the CPU module yourself:
>>
>> http://www.eluaproject.net/en_refman_gen_cpu.html#cpu_constants
>>
>> Best,
>> Bogdan
>>
>> > 2010/8/4 James Snyder <[hidden email]>
>> >>
>> >> Yep.  I'm currently following a policy of configuring these sorts of
>> >> things automatically if there's only one pin that can be used for a
>> >> configuration.
>> >>
>> >> I think what would be nice is for platform.c to have data on usable
>> >> pin mappings for various peripherals that are supported, and if the
>> >> user asks to set up the peripheral by referring to a pin rather than
>> >> the device id, it will attempt to set up the pin for that use.
>> >> Admittedly there may currently be some scenarios where if something
>> >> like CAN is set up on STM32 there may not be a way to revert the pin
>> >> to default behavior without a reset (though I would have to check).
>> >>
>> >> On Tue, Aug 3, 2010 at 4:22 PM, Bogdan Marinescu
>> >> <[hidden email]> wrote:
>> >> > On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
>> >> > <[hidden email]> wrote:
>> >> >> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder
>> >> >> <[hidden email]>
>> >> >> wrote:
>> >> >>> One thing that may or may not have been brought up yet is that this
>> >> >>> platform requires pins to be configured for certain outputs to
>> >> >>> work.
>> >> >>> I'm not sure what the defaults are on this board, but you may need
>> >> >>> to
>> >> >>> set the contents of some PINSEL registers.
>> >> >>>
>> >> >>> pwmled.lua does this:
>> >> >>> elseif pd.board() == 'ELUA-PUC' then
>> >> >>>  pwmid, tmrid = 7, 0
>> >> >>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>> >> >>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>> >> >>>  cpu.w32( cpu.IO_PINSEL3, psel )
>> >> >>>
>> >> >>> It likely wouldn't be too hard to have a wrapper function that does
>> >> >>> this, similar to the mbed one, since the configuration models are
>> >> >>> almost the same for these platforms.
>> >> >>>
>> >> >>> The PINSEL register descriptions should be in the LPC2468 manual.
>> >> >>
>> >> >> Thanks James, that's probably the problem. I'll try to fix it in SVN
>> >> >> tonight, although your solution provides a nice workaround directly
>> >> >> in
>> >> >> eLua.
>> >> >
>> >> > Actually, I'll probably not try to fix it directly in SVN, since the
>> >> > I/O configuration of the LPC2468 allows multiple pins as outputs for
>> >> > the same PWM channel. As I don't know what pins Ives is trying to
>> >> > use,
>> >> > probably the best method for him is to use the method above, tailored
>> >> > to his specific needs. Datasheet to the rescue! :)
>> >> >
>> >> > Best,
>> >> > Bogdan
>> >> >>>
>> >> >>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]>
>> >> >>> wrote:
>> >> >>>> Hi,
>> >> >>>>     I just tried some more things with no good result, so I gonna
>> >> >>>> report my
>> >> >>>> tests for you know better what is happening.
>> >> >>>>    At first I tested this code on EKLM3S8962 and it worked.
>> >> >>>>
>> >> >>>>   pwm.setclock( 0, 12000000 )
>> >> >>>>   pwm.setup( 0, 5000, 90 )
>> >> >>>>   pwm.start( 0 )
>> >> >>>>   pwm.setup( 1, 5000, 10 )
>> >> >>>>   pwm.start( 1 )
>> >> >>>>
>> >> >>>> so I tried it on eLua Demo Board and again my exit signal was a
>> >> >>>> 2.8V
>> >> >>>> DC.
>> >> >>>> I turned on all PWM on Demo board, and saw all the pins that have
>> >> >>>> PWM
>> >> >>>> function, and again the exit was a 2.8V DC.
>> >> >>>> Then I tryed to use I/O function on some of this pins to see if
>> >> >>>> there
>> >> >>>> were
>> >> >>>> any connection problem, and all the pins worked properly.
>> >> >>>> I have a deadline of a week, is possible to solve this til then?
>> >> >>>> Could someone else test this function on LPC?
>> >> >>>>
>> >> >>>> Thanks again
>> >> >>>> Ives
>> >> >>>>
>> >> >>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>> >> >>>>>
>> >> >>>>> Hi,
>> >> >>>>>
>> >> >>>>> Thanks for the report, I'll take a look at it.
>> >> >>>>>
>> >> >>>>> Best,
>> >> >>>>> Bogdan
>> >> >>>>>
>> >> >>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]>
>> >> >>>>> wrote:
>> >> >>>>> > Hi,
>> >> >>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board(
>> >> >>>>> > LPC2468
>> >> >>>>> > ),
>> >> >>>>> > but at the exit pin I only see a DC level.
>> >> >>>>> > This is what I am doing:
>> >> >>>>> >
>> >> >>>>> > pwm.setclock( 0, 12000000 )
>> >> >>>>> > pwm.setup( 0, 5000, 90 )
>> >> >>>>> > pwm.start( 0 )
>> >> >>>>> >
>> >> >>>>> > pwm.setup( 1, 5000, 30 )
>> >> >>>>> > pwm.start( 1 )
>> >> >>>>> >
>> >> >>>>> > Am I missing something here?
>> >> >>>>> >
>> >> >>>>> > Thanks,
>> >> >>>>> > Ives
>> >> >>>>> > _______________________________________________
>> >> >>>>> > eLua-dev mailing list
>> >> >>>>> > [hidden email]
>> >> >>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >>>>> >
>> >> >>>>> >
>> >> >>>>> _______________________________________________
>> >> >>>>> eLua-dev mailing list
>> >> >>>>> [hidden email]
>> >> >>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >>>>
>> >> >>>>
>> >> >>>> _______________________________________________
>> >> >>>> eLua-dev mailing list
>> >> >>>> [hidden email]
>> >> >>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >>>>
>> >> >>>>
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> James Snyder
>> >> >>> Biomedical Engineering
>> >> >>> Northwestern University
>> >> >>> [hidden email]
>> >> >>> PGP: http://fanplastic.org/key.txt
>> >> >>> Phone: (847) 448-0386
>> >> >>> _______________________________________________
>> >> >>> eLua-dev mailing list
>> >> >>> [hidden email]
>> >> >>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >>>
>> >> >>
>> >> > _______________________________________________
>> >> > eLua-dev mailing list
>> >> > [hidden email]
>> >> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> James Snyder
>> >> Biomedical Engineering
>> >> Northwestern University
>> >> [hidden email]
>> >> PGP: http://fanplastic.org/key.txt
>> >> Phone: (847) 448-0386
>> >> _______________________________________________
>> >> eLua-dev mailing list
>> >> [hidden email]
>> >> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>> > _______________________________________________
>> > eLua-dev mailing list
>> > [hidden email]
>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Ives Cunha Ives Cunha
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

The output is  -536690660, which is the same as E002C01C, but when I use cpu.IO_PINSEL7 on function cpu.w32, the program freezes.
If I use 0xE002C01C it works.

2010/8/4 Bogdan Marinescu <[hidden email]>
On Thu, Aug 5, 2010 at 1:06 AM, Ives Cunha <[hidden email]> wrote:
> I have this on my platform_conf:
> #define PINSEL_BASE_ADDR 0xE002C000
> #define IO_PINSEL0           ( PINSEL_BASE_ADDR + 0x00 )
> #define IO_PINSEL1           ( PINSEL_BASE_ADDR + 0x04 )
> #define IO_PINSEL2           ( PINSEL_BASE_ADDR + 0x08 )
> #define IO_PINSEL3           ( PINSEL_BASE_ADDR + 0x0C )
> #define IO_PINSEL4           ( PINSEL_BASE_ADDR + 0x10 )
> #define IO_PINSEL5           ( PINSEL_BASE_ADDR + 0x14 )
> #define IO_PINSEL6           ( PINSEL_BASE_ADDR + 0x18 )
> #define IO_PINSEL7           ( PINSEL_BASE_ADDR + 0x1C )
> #define IO_PINSEL8           ( PINSEL_BASE_ADDR + 0x20 )
> #define IO_PINSEL9           ( PINSEL_BASE_ADDR + 0x24 )
> #define IO_PINSEL10         ( PINSEL_BASE_ADDR + 0x28 )
>
> #define PLATFORM_CPU_CONSTANTS\
>  _C( IO_PINSEL0 ),\
>  _C( IO_PINSEL1 ),\
>  _C( IO_PINSEL2 ),\
>  _C( IO_PINSEL3 ),\
>  _C( IO_PINSEL4 ),\
>  _C( IO_PINSEL5 ),\
>  _C( IO_PINSEL6 ),\
>  _C( IO_PINSEL7 ),\
>  _C( IO_PINSEL8 ),\
>  _C( IO_PINSEL9 ),\
>  _C( IO_PINSEL10 )
>
> Do I have to do something more?

What is the output of print(cpu.IO_PINSEL0) ?

Best,
Bogdan

> 2010/8/4 Bogdan Marinescu <[hidden email]>
>>
>> On Thu, Aug 5, 2010 at 12:42 AM, Ives Cunha <[hidden email]> wrote:
>> > Hi.
>> >      Thank to you I could fiinally make it work, but the function
>> > cpu.w32
>> > only worked when I used hexadecimal address.
>> >      Is something wrong with platform_conf?
>>
>> It's not wrong, just incomplete. You need to list all the constants
>> that you need to expose via the CPU module yourself:
>>
>> http://www.eluaproject.net/en_refman_gen_cpu.html#cpu_constants
>>
>> Best,
>> Bogdan
>>
>> > 2010/8/4 James Snyder <[hidden email]>
>> >>
>> >> Yep.  I'm currently following a policy of configuring these sorts of
>> >> things automatically if there's only one pin that can be used for a
>> >> configuration.
>> >>
>> >> I think what would be nice is for platform.c to have data on usable
>> >> pin mappings for various peripherals that are supported, and if the
>> >> user asks to set up the peripheral by referring to a pin rather than
>> >> the device id, it will attempt to set up the pin for that use.
>> >> Admittedly there may currently be some scenarios where if something
>> >> like CAN is set up on STM32 there may not be a way to revert the pin
>> >> to default behavior without a reset (though I would have to check).
>> >>
>> >> On Tue, Aug 3, 2010 at 4:22 PM, Bogdan Marinescu
>> >> <[hidden email]> wrote:
>> >> > On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
>> >> > <[hidden email]> wrote:
>> >> >> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder
>> >> >> <[hidden email]>
>> >> >> wrote:
>> >> >>> One thing that may or may not have been brought up yet is that this
>> >> >>> platform requires pins to be configured for certain outputs to
>> >> >>> work.
>> >> >>> I'm not sure what the defaults are on this board, but you may need
>> >> >>> to
>> >> >>> set the contents of some PINSEL registers.
>> >> >>>
>> >> >>> pwmled.lua does this:
>> >> >>> elseif pd.board() == 'ELUA-PUC' then
>> >> >>>  pwmid, tmrid = 7, 0
>> >> >>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>> >> >>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>> >> >>>  cpu.w32( cpu.IO_PINSEL3, psel )
>> >> >>>
>> >> >>> It likely wouldn't be too hard to have a wrapper function that does
>> >> >>> this, similar to the mbed one, since the configuration models are
>> >> >>> almost the same for these platforms.
>> >> >>>
>> >> >>> The PINSEL register descriptions should be in the LPC2468 manual.
>> >> >>
>> >> >> Thanks James, that's probably the problem. I'll try to fix it in SVN
>> >> >> tonight, although your solution provides a nice workaround directly
>> >> >> in
>> >> >> eLua.
>> >> >
>> >> > Actually, I'll probably not try to fix it directly in SVN, since the
>> >> > I/O configuration of the LPC2468 allows multiple pins as outputs for
>> >> > the same PWM channel. As I don't know what pins Ives is trying to
>> >> > use,
>> >> > probably the best method for him is to use the method above, tailored
>> >> > to his specific needs. Datasheet to the rescue! :)
>> >> >
>> >> > Best,
>> >> > Bogdan
>> >> >>>
>> >> >>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]>
>> >> >>> wrote:
>> >> >>>> Hi,
>> >> >>>>     I just tried some more things with no good result, so I gonna
>> >> >>>> report my
>> >> >>>> tests for you know better what is happening.
>> >> >>>>    At first I tested this code on EKLM3S8962 and it worked.
>> >> >>>>
>> >> >>>>   pwm.setclock( 0, 12000000 )
>> >> >>>>   pwm.setup( 0, 5000, 90 )
>> >> >>>>   pwm.start( 0 )
>> >> >>>>   pwm.setup( 1, 5000, 10 )
>> >> >>>>   pwm.start( 1 )
>> >> >>>>
>> >> >>>> so I tried it on eLua Demo Board and again my exit signal was a
>> >> >>>> 2.8V
>> >> >>>> DC.
>> >> >>>> I turned on all PWM on Demo board, and saw all the pins that have
>> >> >>>> PWM
>> >> >>>> function, and again the exit was a 2.8V DC.
>> >> >>>> Then I tryed to use I/O function on some of this pins to see if
>> >> >>>> there
>> >> >>>> were
>> >> >>>> any connection problem, and all the pins worked properly.
>> >> >>>> I have a deadline of a week, is possible to solve this til then?
>> >> >>>> Could someone else test this function on LPC?
>> >> >>>>
>> >> >>>> Thanks again
>> >> >>>> Ives
>> >> >>>>
>> >> >>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>> >> >>>>>
>> >> >>>>> Hi,
>> >> >>>>>
>> >> >>>>> Thanks for the report, I'll take a look at it.
>> >> >>>>>
>> >> >>>>> Best,
>> >> >>>>> Bogdan
>> >> >>>>>
>> >> >>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha <[hidden email]>
>> >> >>>>> wrote:
>> >> >>>>> > Hi,
>> >> >>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo Board(
>> >> >>>>> > LPC2468
>> >> >>>>> > ),
>> >> >>>>> > but at the exit pin I only see a DC level.
>> >> >>>>> > This is what I am doing:
>> >> >>>>> >
>> >> >>>>> > pwm.setclock( 0, 12000000 )
>> >> >>>>> > pwm.setup( 0, 5000, 90 )
>> >> >>>>> > pwm.start( 0 )
>> >> >>>>> >
>> >> >>>>> > pwm.setup( 1, 5000, 30 )
>> >> >>>>> > pwm.start( 1 )
>> >> >>>>> >
>> >> >>>>> > Am I missing something here?
>> >> >>>>> >
>> >> >>>>> > Thanks,
>> >> >>>>> > Ives
>> >> >>>>> > _______________________________________________
>> >> >>>>> > eLua-dev mailing list
>> >> >>>>> > [hidden email]
>> >> >>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >>>>> >
>> >> >>>>> >
>> >> >>>>> _______________________________________________
>> >> >>>>> eLua-dev mailing list
>> >> >>>>> [hidden email]
>> >> >>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >>>>
>> >> >>>>
>> >> >>>> _______________________________________________
>> >> >>>> eLua-dev mailing list
>> >> >>>> [hidden email]
>> >> >>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >>>>
>> >> >>>>
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> James Snyder
>> >> >>> Biomedical Engineering
>> >> >>> Northwestern University
>> >> >>> [hidden email]
>> >> >>> PGP: http://fanplastic.org/key.txt
>> >> >>> Phone: (847) 448-0386
>> >> >>> _______________________________________________
>> >> >>> eLua-dev mailing list
>> >> >>> [hidden email]
>> >> >>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >>>
>> >> >>
>> >> > _______________________________________________
>> >> > eLua-dev mailing list
>> >> > [hidden email]
>> >> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> James Snyder
>> >> Biomedical Engineering
>> >> Northwestern University
>> >> [hidden email]
>> >> PGP: http://fanplastic.org/key.txt
>> >> Phone: (847) 448-0386
>> >> _______________________________________________
>> >> eLua-dev mailing list
>> >> [hidden email]
>> >> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>> > _______________________________________________
>> > eLua-dev mailing list
>> > [hidden email]
>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

On Thu, Aug 5, 2010 at 1:48 AM, Ives Cunha <[hidden email]> wrote:
> The output is  -536690660, which is the same as E002C01C, but when I use
> cpu.IO_PINSEL7 on function cpu.w32, the program freezes.
> If I use 0xE002C01C it works.

Hmmmm. Please try this:

1. open src/modules/cpu.c
2. locate line 128:

lua_pushinteger( L,

>
> 2010/8/4 Bogdan Marinescu <[hidden email]>
>>
>> On Thu, Aug 5, 2010 at 1:06 AM, Ives Cunha <[hidden email]> wrote:
>> > I have this on my platform_conf:
>> > #define PINSEL_BASE_ADDR 0xE002C000
>> > #define IO_PINSEL0           ( PINSEL_BASE_ADDR + 0x00 )
>> > #define IO_PINSEL1           ( PINSEL_BASE_ADDR + 0x04 )
>> > #define IO_PINSEL2           ( PINSEL_BASE_ADDR + 0x08 )
>> > #define IO_PINSEL3           ( PINSEL_BASE_ADDR + 0x0C )
>> > #define IO_PINSEL4           ( PINSEL_BASE_ADDR + 0x10 )
>> > #define IO_PINSEL5           ( PINSEL_BASE_ADDR + 0x14 )
>> > #define IO_PINSEL6           ( PINSEL_BASE_ADDR + 0x18 )
>> > #define IO_PINSEL7           ( PINSEL_BASE_ADDR + 0x1C )
>> > #define IO_PINSEL8           ( PINSEL_BASE_ADDR + 0x20 )
>> > #define IO_PINSEL9           ( PINSEL_BASE_ADDR + 0x24 )
>> > #define IO_PINSEL10         ( PINSEL_BASE_ADDR + 0x28 )
>> >
>> > #define PLATFORM_CPU_CONSTANTS\
>> >  _C( IO_PINSEL0 ),\
>> >  _C( IO_PINSEL1 ),\
>> >  _C( IO_PINSEL2 ),\
>> >  _C( IO_PINSEL3 ),\
>> >  _C( IO_PINSEL4 ),\
>> >  _C( IO_PINSEL5 ),\
>> >  _C( IO_PINSEL6 ),\
>> >  _C( IO_PINSEL7 ),\
>> >  _C( IO_PINSEL8 ),\
>> >  _C( IO_PINSEL9 ),\
>> >  _C( IO_PINSEL10 )
>> >
>> > Do I have to do something more?
>>
>> What is the output of print(cpu.IO_PINSEL0) ?
>>
>> Best,
>> Bogdan
>>
>> > 2010/8/4 Bogdan Marinescu <[hidden email]>
>> >>
>> >> On Thu, Aug 5, 2010 at 12:42 AM, Ives Cunha <[hidden email]> wrote:
>> >> > Hi.
>> >> >      Thank to you I could fiinally make it work, but the function
>> >> > cpu.w32
>> >> > only worked when I used hexadecimal address.
>> >> >      Is something wrong with platform_conf?
>> >>
>> >> It's not wrong, just incomplete. You need to list all the constants
>> >> that you need to expose via the CPU module yourself:
>> >>
>> >> http://www.eluaproject.net/en_refman_gen_cpu.html#cpu_constants
>> >>
>> >> Best,
>> >> Bogdan
>> >>
>> >> > 2010/8/4 James Snyder <[hidden email]>
>> >> >>
>> >> >> Yep.  I'm currently following a policy of configuring these sorts of
>> >> >> things automatically if there's only one pin that can be used for a
>> >> >> configuration.
>> >> >>
>> >> >> I think what would be nice is for platform.c to have data on usable
>> >> >> pin mappings for various peripherals that are supported, and if the
>> >> >> user asks to set up the peripheral by referring to a pin rather than
>> >> >> the device id, it will attempt to set up the pin for that use.
>> >> >> Admittedly there may currently be some scenarios where if something
>> >> >> like CAN is set up on STM32 there may not be a way to revert the pin
>> >> >> to default behavior without a reset (though I would have to check).
>> >> >>
>> >> >> On Tue, Aug 3, 2010 at 4:22 PM, Bogdan Marinescu
>> >> >> <[hidden email]> wrote:
>> >> >> > On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
>> >> >> > <[hidden email]> wrote:
>> >> >> >> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder
>> >> >> >> <[hidden email]>
>> >> >> >> wrote:
>> >> >> >>> One thing that may or may not have been brought up yet is that
>> >> >> >>> this
>> >> >> >>> platform requires pins to be configured for certain outputs to
>> >> >> >>> work.
>> >> >> >>> I'm not sure what the defaults are on this board, but you may
>> >> >> >>> need
>> >> >> >>> to
>> >> >> >>> set the contents of some PINSEL registers.
>> >> >> >>>
>> >> >> >>> pwmled.lua does this:
>> >> >> >>> elseif pd.board() == 'ELUA-PUC' then
>> >> >> >>>  pwmid, tmrid = 7, 0
>> >> >> >>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>> >> >> >>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>> >> >> >>>  cpu.w32( cpu.IO_PINSEL3, psel )
>> >> >> >>>
>> >> >> >>> It likely wouldn't be too hard to have a wrapper function that
>> >> >> >>> does
>> >> >> >>> this, similar to the mbed one, since the configuration models
>> >> >> >>> are
>> >> >> >>> almost the same for these platforms.
>> >> >> >>>
>> >> >> >>> The PINSEL register descriptions should be in the LPC2468
>> >> >> >>> manual.
>> >> >> >>
>> >> >> >> Thanks James, that's probably the problem. I'll try to fix it in
>> >> >> >> SVN
>> >> >> >> tonight, although your solution provides a nice workaround
>> >> >> >> directly
>> >> >> >> in
>> >> >> >> eLua.
>> >> >> >
>> >> >> > Actually, I'll probably not try to fix it directly in SVN, since
>> >> >> > the
>> >> >> > I/O configuration of the LPC2468 allows multiple pins as outputs
>> >> >> > for
>> >> >> > the same PWM channel. As I don't know what pins Ives is trying to
>> >> >> > use,
>> >> >> > probably the best method for him is to use the method above,
>> >> >> > tailored
>> >> >> > to his specific needs. Datasheet to the rescue! :)
>> >> >> >
>> >> >> > Best,
>> >> >> > Bogdan
>> >> >> >>>
>> >> >> >>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]>
>> >> >> >>> wrote:
>> >> >> >>>> Hi,
>> >> >> >>>>     I just tried some more things with no good result, so I
>> >> >> >>>> gonna
>> >> >> >>>> report my
>> >> >> >>>> tests for you know better what is happening.
>> >> >> >>>>    At first I tested this code on EKLM3S8962 and it worked.
>> >> >> >>>>
>> >> >> >>>>   pwm.setclock( 0, 12000000 )
>> >> >> >>>>   pwm.setup( 0, 5000, 90 )
>> >> >> >>>>   pwm.start( 0 )
>> >> >> >>>>   pwm.setup( 1, 5000, 10 )
>> >> >> >>>>   pwm.start( 1 )
>> >> >> >>>>
>> >> >> >>>> so I tried it on eLua Demo Board and again my exit signal was a
>> >> >> >>>> 2.8V
>> >> >> >>>> DC.
>> >> >> >>>> I turned on all PWM on Demo board, and saw all the pins that
>> >> >> >>>> have
>> >> >> >>>> PWM
>> >> >> >>>> function, and again the exit was a 2.8V DC.
>> >> >> >>>> Then I tryed to use I/O function on some of this pins to see if
>> >> >> >>>> there
>> >> >> >>>> were
>> >> >> >>>> any connection problem, and all the pins worked properly.
>> >> >> >>>> I have a deadline of a week, is possible to solve this til
>> >> >> >>>> then?
>> >> >> >>>> Could someone else test this function on LPC?
>> >> >> >>>>
>> >> >> >>>> Thanks again
>> >> >> >>>> Ives
>> >> >> >>>>
>> >> >> >>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>> >> >> >>>>>
>> >> >> >>>>> Hi,
>> >> >> >>>>>
>> >> >> >>>>> Thanks for the report, I'll take a look at it.
>> >> >> >>>>>
>> >> >> >>>>> Best,
>> >> >> >>>>> Bogdan
>> >> >> >>>>>
>> >> >> >>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha
>> >> >> >>>>> <[hidden email]>
>> >> >> >>>>> wrote:
>> >> >> >>>>> > Hi,
>> >> >> >>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo
>> >> >> >>>>> > Board(
>> >> >> >>>>> > LPC2468
>> >> >> >>>>> > ),
>> >> >> >>>>> > but at the exit pin I only see a DC level.
>> >> >> >>>>> > This is what I am doing:
>> >> >> >>>>> >
>> >> >> >>>>> > pwm.setclock( 0, 12000000 )
>> >> >> >>>>> > pwm.setup( 0, 5000, 90 )
>> >> >> >>>>> > pwm.start( 0 )
>> >> >> >>>>> >
>> >> >> >>>>> > pwm.setup( 1, 5000, 30 )
>> >> >> >>>>> > pwm.start( 1 )
>> >> >> >>>>> >
>> >> >> >>>>> > Am I missing something here?
>> >> >> >>>>> >
>> >> >> >>>>> > Thanks,
>> >> >> >>>>> > Ives
>> >> >> >>>>> > _______________________________________________
>> >> >> >>>>> > eLua-dev mailing list
>> >> >> >>>>> > [hidden email]
>> >> >> >>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >> >>>>> >
>> >> >> >>>>> >
>> >> >> >>>>> _______________________________________________
>> >> >> >>>>> eLua-dev mailing list
>> >> >> >>>>> [hidden email]
>> >> >> >>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>> _______________________________________________
>> >> >> >>>> eLua-dev mailing list
>> >> >> >>>> [hidden email]
>> >> >> >>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> --
>> >> >> >>> James Snyder
>> >> >> >>> Biomedical Engineering
>> >> >> >>> Northwestern University
>> >> >> >>> [hidden email]
>> >> >> >>> PGP: http://fanplastic.org/key.txt
>> >> >> >>> Phone: (847) 448-0386
>> >> >> >>> _______________________________________________
>> >> >> >>> eLua-dev mailing list
>> >> >> >>> [hidden email]
>> >> >> >>> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >> >>>
>> >> >> >>
>> >> >> > _______________________________________________
>> >> >> > eLua-dev mailing list
>> >> >> > [hidden email]
>> >> >> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> James Snyder
>> >> >> Biomedical Engineering
>> >> >> Northwestern University
>> >> >> [hidden email]
>> >> >> PGP: http://fanplastic.org/key.txt
>> >> >> Phone: (847) 448-0386
>> >> >> _______________________________________________
>> >> >> eLua-dev mailing list
>> >> >> [hidden email]
>> >> >> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > eLua-dev mailing list
>> >> > [hidden email]
>> >> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >> >
>> >> >
>> >> _______________________________________________
>> >> eLua-dev mailing list
>> >> [hidden email]
>> >> https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>> > _______________________________________________
>> > eLua-dev mailing list
>> > [hidden email]
>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

On Thu, Aug 5, 2010 at 1:56 AM, Bogdan Marinescu
<[hidden email]> wrote:

> On Thu, Aug 5, 2010 at 1:48 AM, Ives Cunha <[hidden email]> wrote:
>> The output is  -536690660, which is the same as E002C01C, but when I use
>> cpu.IO_PINSEL7 on function cpu.w32, the program freezes.
>> If I use 0xE002C01C it works.
>
> Hmmmm. Please try this:
>
> 1. open src/modules/cpu.c
> 2. locate line 128:
>
> lua_pushinteger( L,

Sorry :) So, locate line 128:

lua_pushinteger( L, cpu_constants[ i ].val )

and replace 'lua_pushinteger' with 'lua_pushnumber'. Compile, burn the
image, and check if the problem is still there.
A weird conversion problem is the only idea I have related to this bug.

Thanks,
Bogdan

>>
>> 2010/8/4 Bogdan Marinescu <[hidden email]>
>>>
>>> On Thu, Aug 5, 2010 at 1:06 AM, Ives Cunha <[hidden email]> wrote:
>>> > I have this on my platform_conf:
>>> > #define PINSEL_BASE_ADDR 0xE002C000
>>> > #define IO_PINSEL0           ( PINSEL_BASE_ADDR + 0x00 )
>>> > #define IO_PINSEL1           ( PINSEL_BASE_ADDR + 0x04 )
>>> > #define IO_PINSEL2           ( PINSEL_BASE_ADDR + 0x08 )
>>> > #define IO_PINSEL3           ( PINSEL_BASE_ADDR + 0x0C )
>>> > #define IO_PINSEL4           ( PINSEL_BASE_ADDR + 0x10 )
>>> > #define IO_PINSEL5           ( PINSEL_BASE_ADDR + 0x14 )
>>> > #define IO_PINSEL6           ( PINSEL_BASE_ADDR + 0x18 )
>>> > #define IO_PINSEL7           ( PINSEL_BASE_ADDR + 0x1C )
>>> > #define IO_PINSEL8           ( PINSEL_BASE_ADDR + 0x20 )
>>> > #define IO_PINSEL9           ( PINSEL_BASE_ADDR + 0x24 )
>>> > #define IO_PINSEL10         ( PINSEL_BASE_ADDR + 0x28 )
>>> >
>>> > #define PLATFORM_CPU_CONSTANTS\
>>> >  _C( IO_PINSEL0 ),\
>>> >  _C( IO_PINSEL1 ),\
>>> >  _C( IO_PINSEL2 ),\
>>> >  _C( IO_PINSEL3 ),\
>>> >  _C( IO_PINSEL4 ),\
>>> >  _C( IO_PINSEL5 ),\
>>> >  _C( IO_PINSEL6 ),\
>>> >  _C( IO_PINSEL7 ),\
>>> >  _C( IO_PINSEL8 ),\
>>> >  _C( IO_PINSEL9 ),\
>>> >  _C( IO_PINSEL10 )
>>> >
>>> > Do I have to do something more?
>>>
>>> What is the output of print(cpu.IO_PINSEL0) ?
>>>
>>> Best,
>>> Bogdan
>>>
>>> > 2010/8/4 Bogdan Marinescu <[hidden email]>
>>> >>
>>> >> On Thu, Aug 5, 2010 at 12:42 AM, Ives Cunha <[hidden email]> wrote:
>>> >> > Hi.
>>> >> >      Thank to you I could fiinally make it work, but the function
>>> >> > cpu.w32
>>> >> > only worked when I used hexadecimal address.
>>> >> >      Is something wrong with platform_conf?
>>> >>
>>> >> It's not wrong, just incomplete. You need to list all the constants
>>> >> that you need to expose via the CPU module yourself:
>>> >>
>>> >> http://www.eluaproject.net/en_refman_gen_cpu.html#cpu_constants
>>> >>
>>> >> Best,
>>> >> Bogdan
>>> >>
>>> >> > 2010/8/4 James Snyder <[hidden email]>
>>> >> >>
>>> >> >> Yep.  I'm currently following a policy of configuring these sorts of
>>> >> >> things automatically if there's only one pin that can be used for a
>>> >> >> configuration.
>>> >> >>
>>> >> >> I think what would be nice is for platform.c to have data on usable
>>> >> >> pin mappings for various peripherals that are supported, and if the
>>> >> >> user asks to set up the peripheral by referring to a pin rather than
>>> >> >> the device id, it will attempt to set up the pin for that use.
>>> >> >> Admittedly there may currently be some scenarios where if something
>>> >> >> like CAN is set up on STM32 there may not be a way to revert the pin
>>> >> >> to default behavior without a reset (though I would have to check).
>>> >> >>
>>> >> >> On Tue, Aug 3, 2010 at 4:22 PM, Bogdan Marinescu
>>> >> >> <[hidden email]> wrote:
>>> >> >> > On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
>>> >> >> > <[hidden email]> wrote:
>>> >> >> >> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder
>>> >> >> >> <[hidden email]>
>>> >> >> >> wrote:
>>> >> >> >>> One thing that may or may not have been brought up yet is that
>>> >> >> >>> this
>>> >> >> >>> platform requires pins to be configured for certain outputs to
>>> >> >> >>> work.
>>> >> >> >>> I'm not sure what the defaults are on this board, but you may
>>> >> >> >>> need
>>> >> >> >>> to
>>> >> >> >>> set the contents of some PINSEL registers.
>>> >> >> >>>
>>> >> >> >>> pwmled.lua does this:
>>> >> >> >>> elseif pd.board() == 'ELUA-PUC' then
>>> >> >> >>>  pwmid, tmrid = 7, 0
>>> >> >> >>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>>> >> >> >>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>>> >> >> >>>  cpu.w32( cpu.IO_PINSEL3, psel )
>>> >> >> >>>
>>> >> >> >>> It likely wouldn't be too hard to have a wrapper function that
>>> >> >> >>> does
>>> >> >> >>> this, similar to the mbed one, since the configuration models
>>> >> >> >>> are
>>> >> >> >>> almost the same for these platforms.
>>> >> >> >>>
>>> >> >> >>> The PINSEL register descriptions should be in the LPC2468
>>> >> >> >>> manual.
>>> >> >> >>
>>> >> >> >> Thanks James, that's probably the problem. I'll try to fix it in
>>> >> >> >> SVN
>>> >> >> >> tonight, although your solution provides a nice workaround
>>> >> >> >> directly
>>> >> >> >> in
>>> >> >> >> eLua.
>>> >> >> >
>>> >> >> > Actually, I'll probably not try to fix it directly in SVN, since
>>> >> >> > the
>>> >> >> > I/O configuration of the LPC2468 allows multiple pins as outputs
>>> >> >> > for
>>> >> >> > the same PWM channel. As I don't know what pins Ives is trying to
>>> >> >> > use,
>>> >> >> > probably the best method for him is to use the method above,
>>> >> >> > tailored
>>> >> >> > to his specific needs. Datasheet to the rescue! :)
>>> >> >> >
>>> >> >> > Best,
>>> >> >> > Bogdan
>>> >> >> >>>
>>> >> >> >>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]>
>>> >> >> >>> wrote:
>>> >> >> >>>> Hi,
>>> >> >> >>>>     I just tried some more things with no good result, so I
>>> >> >> >>>> gonna
>>> >> >> >>>> report my
>>> >> >> >>>> tests for you know better what is happening.
>>> >> >> >>>>    At first I tested this code on EKLM3S8962 and it worked.
>>> >> >> >>>>
>>> >> >> >>>>   pwm.setclock( 0, 12000000 )
>>> >> >> >>>>   pwm.setup( 0, 5000, 90 )
>>> >> >> >>>>   pwm.start( 0 )
>>> >> >> >>>>   pwm.setup( 1, 5000, 10 )
>>> >> >> >>>>   pwm.start( 1 )
>>> >> >> >>>>
>>> >> >> >>>> so I tried it on eLua Demo Board and again my exit signal was a
>>> >> >> >>>> 2.8V
>>> >> >> >>>> DC.
>>> >> >> >>>> I turned on all PWM on Demo board, and saw all the pins that
>>> >> >> >>>> have
>>> >> >> >>>> PWM
>>> >> >> >>>> function, and again the exit was a 2.8V DC.
>>> >> >> >>>> Then I tryed to use I/O function on some of this pins to see if
>>> >> >> >>>> there
>>> >> >> >>>> were
>>> >> >> >>>> any connection problem, and all the pins worked properly.
>>> >> >> >>>> I have a deadline of a week, is possible to solve this til
>>> >> >> >>>> then?
>>> >> >> >>>> Could someone else test this function on LPC?
>>> >> >> >>>>
>>> >> >> >>>> Thanks again
>>> >> >> >>>> Ives
>>> >> >> >>>>
>>> >> >> >>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>>> >> >> >>>>>
>>> >> >> >>>>> Hi,
>>> >> >> >>>>>
>>> >> >> >>>>> Thanks for the report, I'll take a look at it.
>>> >> >> >>>>>
>>> >> >> >>>>> Best,
>>> >> >> >>>>> Bogdan
>>> >> >> >>>>>
>>> >> >> >>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha
>>> >> >> >>>>> <[hidden email]>
>>> >> >> >>>>> wrote:
>>> >> >> >>>>> > Hi,
>>> >> >> >>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo
>>> >> >> >>>>> > Board(
>>> >> >> >>>>> > LPC2468
>>> >> >> >>>>> > ),
>>> >> >> >>>>> > but at the exit pin I only see a DC level.
>>> >> >> >>>>> > This is what I am doing:
>>> >> >> >>>>> >
>>> >> >> >>>>> > pwm.setclock( 0, 12000000 )
>>> >> >> >>>>> > pwm.setup( 0, 5000, 90 )
>>> >> >> >>>>> > pwm.start( 0 )
>>> >> >> >>>>> >
>>> >> >> >>>>> > pwm.setup( 1, 5000, 30 )
>>> >> >> >>>>> > pwm.start( 1 )
>>> >> >> >>>>> >
>>> >> >> >>>>> > Am I missing something here?
>>> >> >> >>>>> >
>>> >> >> >>>>> > Thanks,
>>> >> >> >>>>> > Ives
>>> >> >> >>>>> > _______________________________________________
>>> >> >> >>>>> > eLua-dev mailing list
>>> >> >> >>>>> > [hidden email]
>>> >> >> >>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >>>>> >
>>> >> >> >>>>> >
>>> >> >> >>>>> _______________________________________________
>>> >> >> >>>>> eLua-dev mailing list
>>> >> >> >>>>> [hidden email]
>>> >> >> >>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>> _______________________________________________
>>> >> >> >>>> eLua-dev mailing list
>>> >> >> >>>> [hidden email]
>>> >> >> >>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>> --
>>> >> >> >>> James Snyder
>>> >> >> >>> Biomedical Engineering
>>> >> >> >>> Northwestern University
>>> >> >> >>> [hidden email]
>>> >> >> >>> PGP: http://fanplastic.org/key.txt
>>> >> >> >>> Phone: (847) 448-0386
>>> >> >> >>> _______________________________________________
>>> >> >> >>> eLua-dev mailing list
>>> >> >> >>> [hidden email]
>>> >> >> >>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >>>
>>> >> >> >>
>>> >> >> > _______________________________________________
>>> >> >> > eLua-dev mailing list
>>> >> >> > [hidden email]
>>> >> >> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >> James Snyder
>>> >> >> Biomedical Engineering
>>> >> >> Northwestern University
>>> >> >> [hidden email]
>>> >> >> PGP: http://fanplastic.org/key.txt
>>> >> >> Phone: (847) 448-0386
>>> >> >> _______________________________________________
>>> >> >> eLua-dev mailing list
>>> >> >> [hidden email]
>>> >> >> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >
>>> >> >
>>> >> > _______________________________________________
>>> >> > eLua-dev mailing list
>>> >> > [hidden email]
>>> >> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >
>>> >> >
>>> >> _______________________________________________
>>> >> eLua-dev mailing list
>>> >> [hidden email]
>>> >> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >
>>> >
>>> > _______________________________________________
>>> > eLua-dev mailing list
>>> > [hidden email]
>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >
>>> >
>>> _______________________________________________
>>> eLua-dev mailing list
>>> [hidden email]
>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>>
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Ives Cunha Ives Cunha
Reply | Threaded
Open this post in threaded view
|

Re: Help with PWM on LPC2468

It works.

Thanks
Ives

2010/8/4 Bogdan Marinescu <[hidden email]>
On Thu, Aug 5, 2010 at 1:56 AM, Bogdan Marinescu
<[hidden email]> wrote:
> On Thu, Aug 5, 2010 at 1:48 AM, Ives Cunha <[hidden email]> wrote:
>> The output is  -536690660, which is the same as E002C01C, but when I use
>> cpu.IO_PINSEL7 on function cpu.w32, the program freezes.
>> If I use 0xE002C01C it works.
>
> Hmmmm. Please try this:
>
> 1. open src/modules/cpu.c
> 2. locate line 128:
>
> lua_pushinteger( L,

Sorry :) So, locate line 128:

lua_pushinteger( L, cpu_constants[ i ].val )

and replace 'lua_pushinteger' with 'lua_pushnumber'. Compile, burn the
image, and check if the problem is still there.
A weird conversion problem is the only idea I have related to this bug.

Thanks,
Bogdan

>>
>> 2010/8/4 Bogdan Marinescu <[hidden email]>
>>>
>>> On Thu, Aug 5, 2010 at 1:06 AM, Ives Cunha <[hidden email]> wrote:
>>> > I have this on my platform_conf:
>>> > #define PINSEL_BASE_ADDR 0xE002C000
>>> > #define IO_PINSEL0           ( PINSEL_BASE_ADDR + 0x00 )
>>> > #define IO_PINSEL1           ( PINSEL_BASE_ADDR + 0x04 )
>>> > #define IO_PINSEL2           ( PINSEL_BASE_ADDR + 0x08 )
>>> > #define IO_PINSEL3           ( PINSEL_BASE_ADDR + 0x0C )
>>> > #define IO_PINSEL4           ( PINSEL_BASE_ADDR + 0x10 )
>>> > #define IO_PINSEL5           ( PINSEL_BASE_ADDR + 0x14 )
>>> > #define IO_PINSEL6           ( PINSEL_BASE_ADDR + 0x18 )
>>> > #define IO_PINSEL7           ( PINSEL_BASE_ADDR + 0x1C )
>>> > #define IO_PINSEL8           ( PINSEL_BASE_ADDR + 0x20 )
>>> > #define IO_PINSEL9           ( PINSEL_BASE_ADDR + 0x24 )
>>> > #define IO_PINSEL10         ( PINSEL_BASE_ADDR + 0x28 )
>>> >
>>> > #define PLATFORM_CPU_CONSTANTS\
>>> >  _C( IO_PINSEL0 ),\
>>> >  _C( IO_PINSEL1 ),\
>>> >  _C( IO_PINSEL2 ),\
>>> >  _C( IO_PINSEL3 ),\
>>> >  _C( IO_PINSEL4 ),\
>>> >  _C( IO_PINSEL5 ),\
>>> >  _C( IO_PINSEL6 ),\
>>> >  _C( IO_PINSEL7 ),\
>>> >  _C( IO_PINSEL8 ),\
>>> >  _C( IO_PINSEL9 ),\
>>> >  _C( IO_PINSEL10 )
>>> >
>>> > Do I have to do something more?
>>>
>>> What is the output of print(cpu.IO_PINSEL0) ?
>>>
>>> Best,
>>> Bogdan
>>>
>>> > 2010/8/4 Bogdan Marinescu <[hidden email]>
>>> >>
>>> >> On Thu, Aug 5, 2010 at 12:42 AM, Ives Cunha <[hidden email]> wrote:
>>> >> > Hi.
>>> >> >      Thank to you I could fiinally make it work, but the function
>>> >> > cpu.w32
>>> >> > only worked when I used hexadecimal address.
>>> >> >      Is something wrong with platform_conf?
>>> >>
>>> >> It's not wrong, just incomplete. You need to list all the constants
>>> >> that you need to expose via the CPU module yourself:
>>> >>
>>> >> http://www.eluaproject.net/en_refman_gen_cpu.html#cpu_constants
>>> >>
>>> >> Best,
>>> >> Bogdan
>>> >>
>>> >> > 2010/8/4 James Snyder <[hidden email]>
>>> >> >>
>>> >> >> Yep.  I'm currently following a policy of configuring these sorts of
>>> >> >> things automatically if there's only one pin that can be used for a
>>> >> >> configuration.
>>> >> >>
>>> >> >> I think what would be nice is for platform.c to have data on usable
>>> >> >> pin mappings for various peripherals that are supported, and if the
>>> >> >> user asks to set up the peripheral by referring to a pin rather than
>>> >> >> the device id, it will attempt to set up the pin for that use.
>>> >> >> Admittedly there may currently be some scenarios where if something
>>> >> >> like CAN is set up on STM32 there may not be a way to revert the pin
>>> >> >> to default behavior without a reset (though I would have to check).
>>> >> >>
>>> >> >> On Tue, Aug 3, 2010 at 4:22 PM, Bogdan Marinescu
>>> >> >> <[hidden email]> wrote:
>>> >> >> > On Wed, Aug 4, 2010 at 12:11 AM, Bogdan Marinescu
>>> >> >> > <[hidden email]> wrote:
>>> >> >> >> On Wed, Aug 4, 2010 at 12:07 AM, James Snyder
>>> >> >> >> <[hidden email]>
>>> >> >> >> wrote:
>>> >> >> >>> One thing that may or may not have been brought up yet is that
>>> >> >> >>> this
>>> >> >> >>> platform requires pins to be configured for certain outputs to
>>> >> >> >>> work.
>>> >> >> >>> I'm not sure what the defaults are on this board, but you may
>>> >> >> >>> need
>>> >> >> >>> to
>>> >> >> >>> set the contents of some PINSEL registers.
>>> >> >> >>>
>>> >> >> >>> pwmled.lua does this:
>>> >> >> >>> elseif pd.board() == 'ELUA-PUC' then
>>> >> >> >>>  pwmid, tmrid = 7, 0
>>> >> >> >>>  local psel = cpu.r32( cpu.IO_PINSEL3 )
>>> >> >> >>>  psel = bit.bor( bit.band( psel, 0xFFFFFCFF ), 0x00000200 )
>>> >> >> >>>  cpu.w32( cpu.IO_PINSEL3, psel )
>>> >> >> >>>
>>> >> >> >>> It likely wouldn't be too hard to have a wrapper function that
>>> >> >> >>> does
>>> >> >> >>> this, similar to the mbed one, since the configuration models
>>> >> >> >>> are
>>> >> >> >>> almost the same for these platforms.
>>> >> >> >>>
>>> >> >> >>> The PINSEL register descriptions should be in the LPC2468
>>> >> >> >>> manual.
>>> >> >> >>
>>> >> >> >> Thanks James, that's probably the problem. I'll try to fix it in
>>> >> >> >> SVN
>>> >> >> >> tonight, although your solution provides a nice workaround
>>> >> >> >> directly
>>> >> >> >> in
>>> >> >> >> eLua.
>>> >> >> >
>>> >> >> > Actually, I'll probably not try to fix it directly in SVN, since
>>> >> >> > the
>>> >> >> > I/O configuration of the LPC2468 allows multiple pins as outputs
>>> >> >> > for
>>> >> >> > the same PWM channel. As I don't know what pins Ives is trying to
>>> >> >> > use,
>>> >> >> > probably the best method for him is to use the method above,
>>> >> >> > tailored
>>> >> >> > to his specific needs. Datasheet to the rescue! :)
>>> >> >> >
>>> >> >> > Best,
>>> >> >> > Bogdan
>>> >> >> >>>
>>> >> >> >>> On Tue, Aug 3, 2010 at 3:44 PM, Ives Cunha <[hidden email]>
>>> >> >> >>> wrote:
>>> >> >> >>>> Hi,
>>> >> >> >>>>     I just tried some more things with no good result, so I
>>> >> >> >>>> gonna
>>> >> >> >>>> report my
>>> >> >> >>>> tests for you know better what is happening.
>>> >> >> >>>>    At first I tested this code on EKLM3S8962 and it worked.
>>> >> >> >>>>
>>> >> >> >>>>   pwm.setclock( 0, 12000000 )
>>> >> >> >>>>   pwm.setup( 0, 5000, 90 )
>>> >> >> >>>>   pwm.start( 0 )
>>> >> >> >>>>   pwm.setup( 1, 5000, 10 )
>>> >> >> >>>>   pwm.start( 1 )
>>> >> >> >>>>
>>> >> >> >>>> so I tried it on eLua Demo Board and again my exit signal was a
>>> >> >> >>>> 2.8V
>>> >> >> >>>> DC.
>>> >> >> >>>> I turned on all PWM on Demo board, and saw all the pins that
>>> >> >> >>>> have
>>> >> >> >>>> PWM
>>> >> >> >>>> function, and again the exit was a 2.8V DC.
>>> >> >> >>>> Then I tryed to use I/O function on some of this pins to see if
>>> >> >> >>>> there
>>> >> >> >>>> were
>>> >> >> >>>> any connection problem, and all the pins worked properly.
>>> >> >> >>>> I have a deadline of a week, is possible to solve this til
>>> >> >> >>>> then?
>>> >> >> >>>> Could someone else test this function on LPC?
>>> >> >> >>>>
>>> >> >> >>>> Thanks again
>>> >> >> >>>> Ives
>>> >> >> >>>>
>>> >> >> >>>> 2010/7/27 Bogdan Marinescu <[hidden email]>
>>> >> >> >>>>>
>>> >> >> >>>>> Hi,
>>> >> >> >>>>>
>>> >> >> >>>>> Thanks for the report, I'll take a look at it.
>>> >> >> >>>>>
>>> >> >> >>>>> Best,
>>> >> >> >>>>> Bogdan
>>> >> >> >>>>>
>>> >> >> >>>>> On Tue, Jul 27, 2010 at 3:20 AM, Ives Cunha
>>> >> >> >>>>> <[hidden email]>
>>> >> >> >>>>> wrote:
>>> >> >> >>>>> > Hi,
>>> >> >> >>>>> > I am trying to use the PWM0[1] and PWM0[2] on eLua Demo
>>> >> >> >>>>> > Board(
>>> >> >> >>>>> > LPC2468
>>> >> >> >>>>> > ),
>>> >> >> >>>>> > but at the exit pin I only see a DC level.
>>> >> >> >>>>> > This is what I am doing:
>>> >> >> >>>>> >
>>> >> >> >>>>> > pwm.setclock( 0, 12000000 )
>>> >> >> >>>>> > pwm.setup( 0, 5000, 90 )
>>> >> >> >>>>> > pwm.start( 0 )
>>> >> >> >>>>> >
>>> >> >> >>>>> > pwm.setup( 1, 5000, 30 )
>>> >> >> >>>>> > pwm.start( 1 )
>>> >> >> >>>>> >
>>> >> >> >>>>> > Am I missing something here?
>>> >> >> >>>>> >
>>> >> >> >>>>> > Thanks,
>>> >> >> >>>>> > Ives
>>> >> >> >>>>> > _______________________________________________
>>> >> >> >>>>> > eLua-dev mailing list
>>> >> >> >>>>> > [hidden email]
>>> >> >> >>>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >>>>> >
>>> >> >> >>>>> >
>>> >> >> >>>>> _______________________________________________
>>> >> >> >>>>> eLua-dev mailing list
>>> >> >> >>>>> [hidden email]
>>> >> >> >>>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>> _______________________________________________
>>> >> >> >>>> eLua-dev mailing list
>>> >> >> >>>> [hidden email]
>>> >> >> >>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>> --
>>> >> >> >>> James Snyder
>>> >> >> >>> Biomedical Engineering
>>> >> >> >>> Northwestern University
>>> >> >> >>> [hidden email]
>>> >> >> >>> PGP: http://fanplastic.org/key.txt
>>> >> >> >>> Phone: (847) 448-0386
>>> >> >> >>> _______________________________________________
>>> >> >> >>> eLua-dev mailing list
>>> >> >> >>> [hidden email]
>>> >> >> >>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >>>
>>> >> >> >>
>>> >> >> > _______________________________________________
>>> >> >> > eLua-dev mailing list
>>> >> >> > [hidden email]
>>> >> >> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >> >
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >> James Snyder
>>> >> >> Biomedical Engineering
>>> >> >> Northwestern University
>>> >> >> [hidden email]
>>> >> >> PGP: http://fanplastic.org/key.txt
>>> >> >> Phone: (847) 448-0386
>>> >> >> _______________________________________________
>>> >> >> eLua-dev mailing list
>>> >> >> [hidden email]
>>> >> >> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >
>>> >> >
>>> >> > _______________________________________________
>>> >> > eLua-dev mailing list
>>> >> > [hidden email]
>>> >> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >> >
>>> >> >
>>> >> _______________________________________________
>>> >> eLua-dev mailing list
>>> >> [hidden email]
>>> >> https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >
>>> >
>>> > _______________________________________________
>>> > eLua-dev mailing list
>>> > [hidden email]
>>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>>> >
>>> >
>>> _______________________________________________
>>> eLua-dev mailing list
>>> [hidden email]
>>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>>
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev