cancel
Showing results for 
Search instead for 
Did you mean: 

programming the control register (st7538)

thorsten-kopp
Associate II
Posted on September 23, 2005 at 06:01

programming the control register (st7538)

37 REPLIES 37
thorsten-kopp
Associate II
Posted on November 10, 2004 at 06:34

Hi,

I use the ST7538 with the PIC16F877 from Microchip.

My problem is to write the control register.

I try to do the initialization in this way:

..

RxTx = 0;

REG_DATA = 1;

spi_write(0b11101101);

spi_write(0b10100001);

spi_write(0b01100101);

REG_DATA = 0;

...

Everytime the frequency (MCLK / pin11) changes to 16MHz.

I think it should be 8MHz according to my programming.

The REG_OK pin is low.

Who can help?

krapf
Associate II
Posted on December 09, 2004 at 15:14

Hi,

I could not use the PIC SPI in the ST7538 communication, instead, I made a interrupt function tied to an external pin (CLR/T).

For writing operations, my interrupt is sensible to rising edge transitions, for reading operations, the interrupt is sensible to falling edge.

Did this helped you someway?

Rafael Krapf

BRASIL

thorsten-kopp
Associate II
Posted on December 14, 2004 at 08:38

Hi Rafael,

I tried it with the external interrupt (RB0-Interrupt), but the

received message was wrong. Can you tell me more about

your configurations (st7538 & yC)?

Regards

Thorsten

boicuflorin
Associate II
Posted on December 20, 2004 at 05:39

Hello Chiptuner,

I use the ST7538 with the MSP430 from TexasI. I made

a synchronous communication (read/write) beetwen ST

and MSP430 based on interrupt from CLRT pin.

If you understand ti-msp430 routine I can send you my

communication routine.

Regards

BF

krapf
Associate II
Posted on December 22, 2004 at 15:01

Sorry for the response time! I am busy here 🙂

By the way, I am using B0 tied to CLRT ST7538 pin,

when I am receiving, I set the interrupt for RISING edge by seting the bit 6 in the OPTION register. So when the interruption occurs I read the pin assigned to the data line, and put this data in my memory shift register.

When I am sending data I CLEAR the bit 6 in the OPTION register, so, when interruption occurs, I set the desired data in the data line...

This way, when the rising edge of CLRT occurs, the data is stable at data line. And there is time enought because the PLC speed is very slow (I am using a 10MHz crystal) :D :D

Any further questions?

thorsten-kopp
Associate II
Posted on January 14, 2005 at 09:33

Thanks for your answers!

I have now the problem that the received message is often shifted by one bit. Is it possible that the wiring causes this problem?

krapf
Associate II
Posted on January 14, 2005 at 09:50

Hi,

I had a problem very close to yours...

How I debugged:

With a scope and an extra output pin to work as debug pin, I wrote my state machine such a way as when one bit was received by the uC, the uC output to debug pin a signal (that I can check in the scope).

This way, I found that I was counting 25 bits, not 24! :-Y

Just because the way the state machine transitions were made.

So I changed the state machine transitions implementation and all worked fine.

Can you implement a debug scenario like mine?

If so, and if you still have a free I/O pin in your uC I suggest this method.

Let me know your results 😉

Rafael Krapf

BRASIL

thorsten-kopp
Associate II
Posted on January 18, 2005 at 07:00

Hi,

I checked the programming with a oscilloscope.

My problem is that there is a wrong synchronization

(not constant) between the receiving message and the

clock on clr/t-pin. :(

krapf
Associate II
Posted on January 18, 2005 at 09:24

Quote:

On 18-01-2005 at 11:30, chiptuner wrote:

Hi,

I checked the programming with a oscilloscope.

My problem is that there is a wrong synchronization

(not constant) between the receiving message and the

clock on clr/t-pin. :(

The scope never lies...

If you do not follow the timing specification at page 12, figure 2 (in ST7538 datasheet) the programming will not work.

Good luck!!! :D