MCU User Forum
  cp2201 error codes

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   cp2201 error codes
vprokofiev
New Member
posted July 23, 2010 03:26 AM     Click Here to See the Profile for vprokofiev   Click Here to Email vprokofiev     Edit/Delete Message
We created own pcb for CP2201 and F340. We used scheem from CP2201EK. But after change pin configuration for new board, error appear.

function CP220x_HW_Reset() returns CAL_ERROR.

What does it mean? Where I can find error codes for this functions?

Best regards

IP: Logged

vprokofiev
New Member
posted July 23, 2010 07:23 AM     Click Here to See the Profile for vprokofiev   Click Here to Email vprokofiev     Edit/Delete Message
CAL_ERROR - self-initialization error

Is my CP2201 die?
Or it may be error in pin configuration on F340?

IP: Logged

Tsuneo
Member
posted July 23, 2010 10:39 AM     Click Here to See the Profile for Tsuneo   Click Here to Email Tsuneo     Edit/Delete Message
> Is my CP2201 die?
> Or it may be error in pin configuration on F340?

Likely soldering problem, but check it in order.

1) Code modification on SiLabs TCP/IP stack for CP2201EK is found in this post.
http://www.cygnal.org/ubb/Forum1/HTML/001691.html
You may add another modification for ports, for your board configuration.
If you would want confirmation, post your schematic and initialization code.

Anyway, it's better to check the soldering of CP2201 pins.

2) Next, run an example code and check the CP2201 status.
Connect SiLabs IDE to your board over a debug adapter.
Just after CP220x_HW_Reset(), put a break point.
When the execution stops at the break point, read out CP2201 registers over IDE debug function.

a) RSTSTA: Reset Source Status Register
'View' menu > Debug Windows > CP2200 > BasicExtRegs.ini Registers
usually, it's value is 0x01

b) MAC address (written in factory)
'View' menu > Debug Windows > CP2200 > Indirect Memory > FLASH
6 byte MAC address starts at 0x1FFA on the 8K bytes FLASH
00-0B-3C-00-xx-xx

If you can't read out CP2201 registers and FLASH, you have trouble on the bus connection between the 'F340 and CP2201.

Tsuneo

IP: Logged

vprokofiev
New Member
posted July 26, 2010 04:44 AM     Click Here to See the Profile for vprokofiev   Click Here to Email vprokofiev     Edit/Delete Message
Thanks!
I check registers, all values is 0xFF.
When CP2201EK connected to PC, all registers good.

But it is very strange. I change CP2201 chip on first my pcb and create second pcb.
But trouble is on both boards.

I check all wires on pcb. It is similar to CP2201EK.

My scheem:
http://narod.ru/disk/23115668000/P-CAD%20EDA%20-%20%5BSheet1%5D.pdf.html

IP: Logged

vprokofiev
New Member
posted July 26, 2010 05:03 AM     Click Here to See the Profile for vprokofiev   Click Here to Email vprokofiev     Edit/Delete Message
My init. code:

<..>
#if(BOARD == CP2201EB)
sbit AB4_RST = P3^6;
#else
sbit AB4_RST = P1^0;
#endif
<..>

void PORT_Init (void)
{
IT01CF =0x67;
XBR1 = 0x40;

P0MDOUT = 0x3F;
P1MDOUT |= 0xC8;
P2MDOUT = 0xFF;
P3MDOUT = 0xFF;


P2 &= ~0x80;
P2 |= 0x40;

P3MDOUT &= ~0x40;
P3 &= ~0x40;

// Set EMIF pins to push pull
P3MDOUT |= 0x80;
P4MDOUT |= 0xFF;
}

<..>

void EMIF_Init (void)
{
#if(BOARD == CP2201EB)
EMI0CF = 0x09;
#else
EMI0CF = 0x1B;
#endif

EMI0TC = 0xFF;
EMI0CN = 0x20;
}

IP: Logged

vprokofiev
New Member
posted July 26, 2010 08:26 AM     Click Here to See the Profile for vprokofiev   Click Here to Email vprokofiev     Edit/Delete Message
Bug was found, but i do not understand it.

In my board, reset pin is P3^6 instead of P0^6 ( pinconfig and reset functions was changed accordingly to P3^6 )

When this code run, P3^6 is oscillate:

do {
temp_char = INT0RD;

if(timeout_expired()){
//return CAL_ERROR;
}

} while(1);

Therefore reset signal was setting then F340 read CP2201 registers.

Then I cut P3^6 reset wire from F340. Registers read correct

IP: Logged

Tsuneo
Member
posted July 26, 2010 10:26 PM     Click Here to See the Profile for Tsuneo   Click Here to Email Tsuneo     Edit/Delete Message
> In my board, reset pin is P3^6 instead of P0^6
> When this code run, P3^6 is oscillate

I see.
The code sets the EMIF multiplexed / split mode with bank select, as I posted on above link. In this setting, Port3 is assigned to high byte of external address bus, while the firmware accesses to the CP2201. In this period, the port3 value comes from EMI0CN, which is assigned to BASE_ADDRESS in the EMIF initialization.


mn_userconst.h

// The C8051F340 has 4K of on-chip XRAM. Off-chip access begins at 0x1000.
// Load EMI0CN with 0x10.
#define BASE_ADDRESS 0x10

As the BASE_ADDRESS is 0x10, P3.6 is reset to low while the firmware accesses to the CP2201.

While the external bus is in idle, Port3 is kept in "parking" value, ie. P3 latch value. As the default, P3 latch value is 0xFF. P3.6 goes high in idle.

In this way, the "oscillation" is observed. You'll see this "oscillation" on other Port3 pins, too.


> Then I cut P3^6 reset wire from F340.

It's better to keep the reset function for error recovery.
To set up P3.6 for the CP2201 reset pin,
- Change EMIF mode to multiplexed / split mode without bank select
- Keep CP2201 #CS pin low (active).


EMI0CF = 0x05; // multiplexed / split mode without bank select
P3 = 0x7F; // keep CP2201 #CS (P3.7) to low.

This modification makes other Port3 pins available, too.
You are connecting LCD pins to Port3.

Tsuneo

[This message has been edited by Tsuneo (edited July 26, 2010).]

IP: Logged

vprokofiev
New Member
posted July 27, 2010 06:35 AM     Click Here to See the Profile for vprokofiev   Click Here to Email vprokofiev     Edit/Delete Message
Tsuneo, Thanks for helpful answers!
It is working fine!

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | MCU User Forum

Have you seen our MCU Knowledge Base?


Ultimate Bulletin Board 5.47b