iMX6 SSI with absolute value encoder

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX6 SSI with absolute value encoder

1,863 Views
dirkschäfer
Contributor III

Hello,

on an ATMEL G45 I use the SSI interface with an absolute value encoder. TXD is hardwired with RXC. I send 0xAAAAAAAA followed by 0xFFFFFFFF forever. The clock send out by TXD is given over RS422 to the absolute value encoder and TXC. TXD is 32bit, RXD is 16bit. So after sending 32bits 0xAAAAAAAA, there are 16bits in RXD, clocked by RXC. I than read the absolute position of the encoder.

Now I want this with the iMX6. But I am lost. The clock is controlled by the CCM. But which register to set the data to send?

And from which register reading the data coming in?

Chapter 16, AUDMUX, just explains timing and data control registers. I wired AUD4_TXD to RS422 and AUD4RXC. And AUD4RXD to a RS422-reciever. The enocder returns gray-code and just needs a clock, generated from TXD.

No OS used. To start, I would like to know how to set the data to send over TXD.

Many thanks for your help.

Labels (1)
0 Kudos
Reply
7 Replies

1,505 Views
dirkschäfer
Contributor III

I overlooked Chapter 61, excuse this please.

How to connect AUD4_TXD to SSI1, for example?

0 Kudos
Reply

1,505 Views
igorpadykov
NXP Employee
NXP Employee

Hi Dirk

one can look at attached example from sdk, also please

Chapter 5, Chapter 32 Configuring the SSI Driver iMX6_Firmware_Guide.pdf.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,505 Views
dirkschäfer
Contributor III

Hello Igor,

I still have a problem to get the RXC over the PIN. If I configure AUDMUX4_RXC as outport, source to port 4, sending data stopps.

Why touching RXC influence sending data?

The TXD is connected to RXD, because I want to generate the clock for the absolute value encoder by the bitmaks transmitted. The falling edges than should be the clock for recieving.

Many thanks for your help.

0 Kudos
Reply

1,505 Views
dirkschäfer
Contributor III

Hello Igor,

I tried:

// PINs

m_muxAud4TXD.SetAddr( 0x020E0050);

m_muxAud4TXD.SetValue( 3);    // ALT3

// configure AUDMUX 4

m_portTiming.SetAddr( 0x021D8018);

m_dataCtrl.SetAddr( 0x021D801C);

// TXC as output, TXC as output, RXC from port

m_portTiming.SetValue( (1<<26) + (1<<16) + (8<<12) );

// connected to SSI1

m_dataCtrl.SetValue(0);

// configure SSI

m_stx0.SetAddr( 0x02028000);

m_srx0.SetAddr( 0x02028008);

m_ctrl.SetAddr( 0x02028010);

m_txconf.SetAddr( 0x0202801C);

m_rxconf.SetAddr( 0x02028020);

m_txclock.SetAddr( 0x02028024);

m_rxclock.SetAddr( 0x02028028);

// recv enable, tx enable, ssi enable

m_ctrl.SetValue( (1<<2) + (1<<1) + (1<<0) );

// lsb_aligned, internal clock

m_txconf.SetValue( (1<<9) + (1<<5) );

// lsb_aligned, external clock

m_rxconf.SetValue( (1<<9) );

// 32bit

m_txclock.SetValue( (1<<18) + (1<<17) + (15<<13) );

// 16bit, no divider or prescaler

m_rxclock.SetValue( (7<<13) );

Every second writing 0xAAAAAAAA to m_stx0. Clocks for SSI1 are enabled in ccgr5.

No output. SSI1 and AUDMUX4 should be muxed.

Is it right to set AUDMUX4 to port 1, meaning SSI1?

0 Kudos
Reply

1,505 Views
dirkschäfer
Contributor III

Tried the following:

I used AUDMUX1, and connect it to port4. And SSI1, because it seems to be connected to AUDMUX1.

m_portTiming.SetAddr( 0x021D8000);//0x021D8018);

m_dataCtrl.SetAddr( 0x021D8004);//0x021D801C);

// RC from RXC pin AUD4, 1011

m_portTiming.SetValue( /*(1<<26) + (3<<22) +/*(1<<16) +*/ (11<<12) );

// connected to SSI1

// no, to AUD4

m_dataCtrl.SetValue( 3<<13);

No output on AUDMUX4_TXD. With bitbanging the absolute value encoder works fine.

Where am I wrong?

0 Kudos
Reply

1,505 Views
dirkschäfer
Contributor III

Got output:

AUDMUX4 TXD is connected to the RS422 transmitter, internal use of AUDMUX1 and therefor SSI1.

// TXD, RXD and RXC to ALT 3

m_muxAud4TXD.SetAddr( 0x020E0050);

m_muxAud4TXD.SetValue( 3);    // ALT3

// GPIO1_IO15, SW_PAD_CTL_PAD_SD2_DATA0, ALT 3

m_muxAud4RXD.SetAddr( 0x020E0054);

m_muxAud4RXD.SetValue(3);

// GPIO1_IO11, IOMUXC_SW_MUX_CTL_PAD_SD2_CMD, ALT3

m_muxAud4RXC.SetAddr( 0x020E0358);

m_muxAud4RXC.SetValue(3);

// configure AUDMUX1

m_audm1_ptcr.SetAddr( 0x021D8000);

m_audm1_pdcr.SetAddr( 0x021D8004);

// AUDMUX1 to AUDMUX4, TCLKDIR out, port 4

m_audm1_ptcr.SetValue( (1<<26) + (3<<22) );

m_audm1_pdcr.SetValue( (3<<13) );

// configure AUDMUX4

m_audm4_ptcr.SetAddr( 0x021D8018);

m_audm4_pdcr.SetAddr( 0x021D801C);

// recv clock as output, dest is 0

m_audm4_ptcr.SetValue( (1<<16) + (8<<12));//0000800);

m_audm4_pdcr.SetValue( 0 );     // port 1 is 000 as mask

// Configure SSI1

m_ssi1cr.SetAddr( 0x02028010);

// rec enabled, trans enabled, SSI enable

m_ssi1cr.SetValue(   (1<<2) + (1<<1) + (1<<0) );

m_ssi1stx0.SetAddr( 0x02028000);

m_ssi1srx0.SetAddr( 0x02028008);

m_ssi1stcr.SetAddr( 0x0202801C);

// internal clock, clock divided by 256

m_ssi1stcr.SetValue( (1<<7) + (1<<5) + 0xFF );

m_ssi1stccr.SetAddr( 0x02028024);

// not more then 24bit, divider and prescaler

m_ssi1stccr.SetValue( (1<<18) + (1<<17) + (11<<13) );

// receive

m_ssi1srcr.SetAddr( 0x02028020);

m_ssi1srccr.SetAddr( 0x02028028);

m_ssi1srcr.SetValue( (1<<7) );

m_ssi1srccr.SetValue( (7<<13) );

// FIFO control

m_ssi1sfcsr.SetAddr( 0x0202802C);

Writing a bit mask to m_ssi1stx0 is sent out to the PIN.

0 Kudos
Reply

1,505 Views
dirkschäfer
Contributor III

No Input:

The TXC is connected to the TXD, so the recieve-clock should be done by the bitmask sent out to TXD.

AUDMUX4 must be aware of TXC.

Is it enough to configure

// recv clock as output, dest is 0

m_audm4_ptcr.SetValue( (1<<16) + (8<<12));

// to port 1

m_audm4_pdcr.SetValue( 0 );

AND

// recieve control, FIFO 0 enable, falling edge, external clock (1<<5) ?

m_ssi1srcr.SetValue( (1<<7) );

// no divider, TXD does clocking, 16bit,

m_ssi1srccr.SetValue( (7<<13) );

FIFO control never shows data in RECV.

0 Kudos
Reply