Author Topic: M52232 custom board  (Read 6685 times)

Offline miodrag

  • Newbie
  • *
  • Posts: 4
    • View Profile
M52232 custom board
« on: May 19, 2008, 12:29:29 PM »
Hi All!

I have custom built board with M52232.
I am using P&E Micro USB Multilink for programming and debugging, uTasker SP7.0.

uTasker target : M52232EVB_ROM.

I changed following in uTasker:
-app_hw_m52232x.h :
Code: [Select]
#ifdef _M52232
      #define SIZE_OF_FLASH              (128*1024)
 #else
     #define SIZE_OF_FLASH              (256*1024)   
 #endif
.
.
.
#ifdef _M52232         
    #define PLL_MUL                        10                        // 50 MHz operation
#else       
    #define PLL_MUL                        12                        // 60MHz operation
#endif         
.
.
.
#define CONFIGURE_WATCHDOG         0

-config.h:
 disabled FTP, SMTP, POP3, HTTP, TELNET & DHCP.

-M52235EVB_FLASH.lcf
Code: [Select]
MEMORY
{
    flash1  (RX)   : ORIGIN = 0x00000000, LENGTH = 0x000400
    flashconfig   (RX)   : ORIGIN = 0x00000400, LENGTH = 0x00000018 
  //flash2  (RX)   : ORIGIN = 0x00000420, LENGTH = 0x003FBE0
    flash2  (RX)   : ORIGIN = 0x00000420, LENGTH = 0x001FBE0
    vectorram(RWX) : ORIGIN = 0x20000000, LENGTH = 0x00000400
    sram    (RWX)  : ORIGIN = 0x20000400, LENGTH = 0x00007C00
  //sram    (RWX)  : ORIGIN = 0x20000400, LENGTH = 0x00003C00 */  /* first tests with M52221 */
    ipsbar  (RWX)  : ORIGIN = 0x40000000, LENGTH = 0x0
}
.
.
.
__FLASH_SIZE = 0x00020000;


I have set default network setting and MAC address so that device can connect to my LAN:
Code: [Select]
static const NETWORK_PARAMETERS network_default = {
    (AUTO_NEGOTIATE | FULL_DUPLEX | RX_FLOW_CONTROL),                    // usNetworkOptions - see driver.h for other possibilities
    {0x00, 0x04, 0xA3, 0x00, 0x00, 0x01},                                // ucOurMAC - when no other value can be read from parameters this will be used
    { 192, 168, 164, 55 },                                                  // ucOurIP - our default IP address
    { 255, 255, 255, 0 },                                                // ucNetMask - Our default network mask
    { 192, 168, 164, 1 },                                                  // ucDefGW - Our default gateway
    { 192, 168, 164, 1 },                                                  // ucDNS_server - Our default DNS server
};

I also enabled LAN_REPORT_ACTIVITY.

With this setup I can write program to internal falsh and debug it (only 1 breakpoint !?). After initialization, application goes to fnDoLowPower. Nothing happens with ethernet (LEDs are off, and I can't ping device from my computer).

Can anyone help and tell me if I am doing the right thing with modifications?
I am trying to setup minimal application firts, so that I can move on to building full application.











« Last Edit: May 19, 2008, 07:01:07 PM by miodrag »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3191
    • View Profile
    • uTasker
Re: M52232 custom board
« Reply #1 on: May 19, 2008, 10:14:44 PM »
Hi

Your changes look fine. You have set the FLASH size to suit the chip and also set the PLL to 50MHz to respect the maximum (specified) speed of the device. Also the linker file changes look good (although this shouldn't be necessary for first tests since the project code will not use any addresses above 128k).

You have disabled the watchdog so this will exclude any debuging problems.

The Coldfire has 2 hardware breakprints, stepping in certain code can be a problem (like in case statements or some if/else) since it wants to put down more break points than available - a tip if to switch to assembler (or mixed view) mode and step this part in asembler so that it doesn't try to break on all decision possibilities.

Although almost certainly not a problem yet, ensure that the file system is specified to be smaller enough to fit in the first 128k of FLASH to avoid exceptions when the file system tries to work outside of the range.

Does the RUN LED blink (2.5s interval)? This will indicate that the board is basically operating correctly. It is in fact quite normal that (when the low power task is active) the CPU spends almost all of its time in the low WAIT mode in this task. It will be woken only for a few us every 50ms or so so don't get fooled that the code is getting stuck there - this shouldn't be the case. However it may be best to disable the low power option for first tests to be sure...

If the board is running, it may be that you have a problem with the LAN connection in the new hardware. On the other hand you may be suffering from the well-known auto-negotioation bug in the first silicon release - see the following:
http://www.utasker.com/forum/index.php?topic=254.0

Good luck

Regards

Mark



Offline miodrag

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: M52232 custom board
« Reply #2 on: May 20, 2008, 11:23:08 AM »
Hi Mark

Thanks for your reply. Setting the LAN speed helped with LAN connection. I also disabled LOW POWER mode, but still can't ping the device from my computer. What should be set for ping to function properly? USE_ICMP is enabled in config.h
Code: [Select]
#define USE_ICMP                                                 // enable ICMP

#ifdef USE_ICMP                                                  // specify ICMP support details
  #define ICMP_PING                                            // allow PING reply
  #define ICMP_SEND_PING                                       // support PING transmission
  #define ICMP_DEST_UNREACHABLE                                // allow destination unreachable if no UDP port exists
#endif

Quote
Although almost certainly not a problem yet, ensure that the file system is specified to be smaller enough to fit in the first 128k of FLASH to avoid exceptions when the file system tries to work outside of the range.

How do you do this exactly? I couldn't find where it was defined.

Regards
Miodrag

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3191
    • View Profile
    • uTasker
Re: M52232 custom board
« Reply #3 on: May 20, 2008, 10:53:04 PM »
Hi Miodrag

The only things needed for the ping to work would be USE_ICMP and ICMP_PING (plus of course the Ethernet support). I  don't know why you can not ping the board at the moment but you may do best to monitor the network using Ethereal/Wireshark to see whether you see answers to ARP frames. Then try debugging reception in _fec_rx_frame_isr() to see whether the Ethernet controller is actually receiving anything.


For the file system size, see config.h

        #define uFILE_START 0x18000                                      // FLASH location at 96k start
        #define SINGLE_FILE_SIZE (1*FLASH_GRANULARITY)  // each file a multiple of 2k
        #define FILE_SYSTEM_SIZE (80*SINGLE_FILE_SIZE)   // 160k reserved for file system (including parameter blocks)


This is too large for a 128k device (assuming the file sytem is being used and is in internal FLASH). Changing to
#define FILE_SYSTEM_SIZE (16*SINGLE_FILE_SIZE), will give 28k (the last 28k in the 128k chip)

If the code is smaller that 96k, the file system can be set to start at a lower address and be made slightly larger...

Good luck

Regards

Mark




Offline miodrag

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: M52232 custom board
« Reply #4 on: May 21, 2008, 01:51:40 PM »
Hi Mark

After using Wireshark I noticed that my computer sends ARP frames as expected, but no reply (or any other frame) is transmitted by M52232. Also, looks like no frames are received in _fec_rx_frame_isr(). After going trough code I noticed that MII speed is set to 0xd instead of 0xa (for 50MHz system clock).

I added in m5223x.h:
Code: [Select]
#define MII_SPEED_50MHZ    (0xa << 1)

and in app_hw_m5223x.c :

Code: [Select]
  #ifdef _M52232
    MSCR = (/*DIS_PREAMBLE*/ MII_SPEED_50MHZ);                             // set up MDC clock to 2.5MHz 
  #else
    MSCR = (/*DIS_PREAMBLE*/ MII_SPEED_60MHZ);                             // set up MDC clock to 2.5MHz
  #endif

Also, looking over the forums I noticed that people use 0x0 as EPHy address. I am not sure what this parameter is and what its value should be but I tried 0x0 and again, device failed to work properly.
Code: [Select]
#define PHY_ADDRESS 0x0

Do you have any idea what could be the problem with application (I am fairly sure hardware is correct).

Regards
Miodrag

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3191
    • View Profile
    • uTasker
Re: M52232 custom board
« Reply #5 on: May 21, 2008, 02:53:37 PM »
Miodrag

The MII speed is maximum 2.5MHz so it is not necessary to tune this for slower PLL since it is not critical. I have run boards at other speeds without it having any detrimental effect on the Ethernet (although it would make sense to make this value adaptive to keep it optimal, as your have done).

The PHY_ADDRESS is not critical. It can be set to any value from 0..0x1f - after setting, the communication with the EPHY is always using this address. If the register EPHYCTL1 is never written to, the PHY defaults to address 0 so PHY_ADDRESS of 0 could be used as long as no other address is set.

I am however still not sure that the board is running. If, for example, the program has crashed due to an exception, the Ethernet (as well as other features) would not work - if the watchdog is not active it will then hang forever. When the CPU hangs but the PHY was configured, the PHY will still be operating and so can still control its LEDs for example. Can you confirm that the program is really running? Eg - is it blinking a run LED or using a serial interface which confirms that it is otherwise operating correctly?

Regards

Mark



Offline miodrag

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: M52232 custom board
« Reply #6 on: May 22, 2008, 11:29:58 AM »
Hi Mark

I managed to trace the problem. Ethernet connector on my custom board was faulty.
Thanks for your help.

Regards
Miodrag.
« Last Edit: May 22, 2008, 01:46:10 PM by miodrag »