Author Topic: My customized hardware  (Read 9586 times)

Offline saurabh

  • Newbie
  • *
  • Posts: 10
    • View Profile
My customized hardware
« on: September 21, 2009, 03:35:16 PM »
Dear all,

I have my hardware derived by MCB2300 ,
What I did before migrate to uTasker , I interfaced external
ADC, EEPROM, and RTC all (bit banged protocols) with
GPIO lines (I have not used internals SPI controllers)!

ADC :  p0.12  p0.23  p3.23  p3.25     (Bit banged SPI)
          SDI     SDO   CS      SCLK


RTC:          p0.6,   p0.7 ,   p0.8     (Bit banged SPI)
                SCLK    BIO      EB     

EEPROM:    p0.27  p0.28                (Bit banged I2C)
                SDA0   SCL0

Now , what we used with this (already developed) bit banged typed
method was software delays (for timing management) , I know this
was not the proper method, but now I want this to work with uTasker.

What I observed when I call old (working) routines for init and read write, it is
not working with uTasker (I am making call to this old drivers within new created task).

I checked PINSELECT and port directions. But i sense that I am missing something.
Should i need to do something with config.h/ app_hw_lpc23xx.h or any other file
for like disabling SPI/I2c from there Port setting from there to make my old drivers
working.

Also one more thing that I am worrying about is that , I was using nichelite OS ,
in they provided function TK_SLEEP(mili_sec) , we made heavy use of this function
(this function delivers control to other tasks and hold execution of current task for
specified time).

How can I compensate this task sleep in uTasker, as there is no task sleep in
uTasker.


-Thanks
Saurabh   


 














Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: My customized hardware
« Reply #1 on: September 21, 2009, 04:09:34 PM »
Hi

First some notes about the LPC23XX uTasker project.

1) By default all peripherals are powered down. When using existing code with peripherals you may need to first power up the peripheral module. See LPC23XX.c _LowLevelInit(), which powers down everything when it starts;

    PCONP = 0;                                                           // disable all peripheral power - the peripherals will be powered on later as used

2) The project is configured to use fast ports when the chip supports there. Legacy ports are not used. It may be that your ports routines are using legacy ports. I am not sure whether there is an incompatibility involved, but it may be better to convert to fast port use.

3) Take a look at the uTasker port macros in LPC23xx.h. Search for "Port macros". You should be able to use these in place of existing code to ensure compatibility with all LPC2xxx devices and also with ports to other chips too.

4) The ports in the LPC2XXX are always powered so the peripheral power up is not required for GPIO use.

"delay routine"
The uTasker project is state-event driven and so doesn't (usually) do in-line delays. Normally it is quite easy to do the same function by starting a timer event (either SW or HW timer) and leaving the task. When the event occurs (the timeout) the task is woken and can continue what it was doing (based on the event arriving in a particular state).

See also the following discussion of this:
http://www.utasker.com/forum/index.php?topic=160.0

See the file ADC_Timers.h in the demo project for examples of using hardware timers to generate delays [TEST_TIMER activates a simple test of this].

Regards

Mark






Offline saurabh

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: My customized hardware
« Reply #2 on: September 25, 2009, 01:02:02 PM »
Thanks mark, Actually there was mismatch of fast and slow port. done well with fast ports.