cancel
Showing results for 
Search instead for 
Did you mean: 

Com ST7-PC

philippe_cardi
Associate II
Posted on February 08, 2006 at 05:02

Com ST7-PC

21 REPLIES 21
philippe_cardi
Associate II
Posted on January 26, 2006 at 06:50

Hello everyone,

I'm having some problems with my ST7 :

1) the ST7 doesn't go in interruption when the TDRE bit is set. (I have enabled the interruptions with the 7th bit of SCICR2 set, and I also enabled global interruptions.)

2) My computer doesn't understand what the ST7 is sending via the MAX232 : the computer shows the integers 0 and 192 which doesn't match with the ASCII code of the char that I've sent.

I hope someone can tell me where to look to understand these problems.

Thank you

Orlando.

[ This message was edited by: Orlando on 26-01-2006 13:12 ]

Viktor POHORELY
ST Employee
Posted on January 26, 2006 at 07:10

conserning your PC, could you check, if you have right settings of the PC (baud rate, number of stop bits, parity), and the same for ST7 (take into account that Fcpu is half of Fclk, and there are 3 prescalers for baud rate).

luter
Associate II
Posted on January 26, 2006 at 07:41

Hi.

According to my experience, i had problems due to the wrong baudrate computation. Try different baudrates on your PC with the same mc baudrate. And not all mc baudrates are serviced correctly by PC.

Good luck

philippe_cardi
Associate II
Posted on January 26, 2006 at 08:41

Hello,

Thank you for answering so soon :

The baud rate of my st7 is : 9600bps (SCIBRR = 0xD2), and I'm sending 8-bit datas .

My computer has no parity bit and the baud rate is 9600 bauds.

Are these good values? I'm also going to change my baud rate as you said.

I'll tell you how it worked.

Thanks

Orlando

Viktor POHORELY
ST Employee
Posted on January 26, 2006 at 11:55

if you have osciloskop, it is a best way to check real baudrate with it. I have made mistake in BR selection lot of time...

9600 is accepted by PC without problem.

philippe_cardi
Associate II
Posted on January 27, 2006 at 05:47

Thank you, but I do not have an oscilloscope.

I changed the baud rate of the st7, now the computer is receiving different datas but they still do not have the good values.

When I made the circuit of the MAX232, I put 1.1µF capas instead of 1µF, do you think this could be a problem?

Orlando

[ This message was edited by: Orlando on 27-01-2006 10:18 ]

philippe_cardi
Associate II
Posted on January 30, 2006 at 13:17

Hello again,

I have tried everything : 7 data bits+parity+stop bit, 7data bits+stop bit, 8 data bits+parity+stop bit, 8 data bits+stop bit and none of them is working.

I don't know what to do...

The MAX232 I'm using is MAX232ECPE.

Does anyone have any idea why I can't get this to work? (and don't say I am the problem... :D )

Here is a part of my main.c :

Code:

<BR> for(i=0;i<10;i++) <BR> { <BR> if(_btst(SCISR,7)) <BR> { <BR> <BR> SCIDR='a'; <BR> <BR> } <BR> <BR> } <BR>

and here is how I define the com :

Code:

<BR>void init_COM(void) <BR>{ <BR> _bset(PEDDR,0); // configures port E0 as output TDO <BR> _bset(PEOR,0); <BR> <BR> _bres(SCICR1,4); //8 bits by bytes <BR> _bres(SCICR1,3); //pas de mise en veille <BR> <BR> //_bset(SCICR2,7); //interrupt enable <BR> <BR> <BR> SCIBRR=0xD2; //4800 bauds <BR> <BR> <BR> _bset(SCICR2,3); //enable transmit <BR>} <BR>

Thanks

Orlando

[ This message was edited by: Orlando on 30-01-2006 21:23 ]

luter
Associate II
Posted on January 31, 2006 at 04:29

Hi.

I am using ST7MC. I configure both TDO and RDI as input floating ports and without any interrupts. I am not sure whether it is valid for your mc as well.

and one more suggestion. what kind of oscillator do u use?

as for me, a found only few mc baudrate divider combinations which compatible with pc baudrates.

wolfgang2399
Associate II
Posted on January 31, 2006 at 06:49

Hi Orlando,

just some ideas:

Do you feed the watchdog regularly?

Are you sure not to get stuck in a discharged interrupt?

...because an unexpected watchdog-reset might cause the error as you describe it.

Regards

WoRo