This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SSI M4F120 with 74HC595

Other Parts Discussed in Thread: PCA9534

I need code with 74HC595 use module SSI. I worked with code but it not finished and 74595 can not latch data.

I need sample code SSI with 74HC595. Please! Thanks a lots of.

I use sterallis M4F120 of TI.


Code:




#include "inc/hw_memmap.h"
#include "inc/hw_ssi.h"
#include "inc/hw_types.h"
#include "driverlib/ssi.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"

int main(void)
{
unsigned long ulindex,i;
unsigned long ulData;

SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
GPIOPinTypeSSI(GPIO_PORTA_BASE,GPIO_PIN_5|GPIO_PIN_2);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3);

SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 100000, 8);
SSIEnable(SSI0_BASE);
for (i=0;i<15;i++)

{

ulData = 0x0F;
SSIDataPut(SSI0_BASE, ulData);
}
while(SSIBusy(SSI0_BASE))
{
}
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, 0x00);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, 0xFF);

while(1)
{

}

}


  • Attempts to mate an HC device with 3V3 MCU - often frustrate.  Usually - the minimum VIH required by the HC is 0.7 VCC (3V5 when HC is powered from 5V) and this is just beyond (above) the output voltage level of most all 3V3 powered MCUs.  Thus - even perfect code and connections may not succeed.

    Check your HC's data - most will accept lower (under 5V) supply voltage - and then your MCU's output has better chance to comply.   Usually easiest to run the HC from same supply (3V3) that powers MCU.  Such will solve the interface "level" issue.

    You provide no clue on interconnect: HC's SHCP should tie to SSI_Clk, HC's DS should tie to SSI_TX.  Three key HC pins remain - STCP transfers data from the HC's shift register to HC's output stage upon rising edge clock.  MR should be tied high - OE low.

    While the GPIO "gain" of serial to parallel is desired - you must commit at minimum 3 GPIO (usually 4 or 5 - w/this chip) thus you net 5 or 4 or just 3 GPIO - not too good.  When you can cascade multiple HC595s a real GPIO net gain results...  (output only - of course)

  • Like cb1 wrote you need to tell more about your connections.

    The HC595 will work perfectly at 3V3 with your controller and if you really need a 5V output, you should use 74HCT595. Just check the timing, since the HC-types are getting quite slow at lower voltages or lower temperatures. If speed is not a problem then look at I2C and a PCA9534. 

  • @Desvig,

    Indeed an HCT part will output ~5V as you state - but does not it enforce a VIH level beyond a 3V3 MCU's output capability?

    Suspect then - most perfect, "shotgun wedding" (MCU to HCT) - results from proper level translator insertion... 

    And - these are available in mini packages & thus avoid the HC "slow-down" (@ lowered supply/temp) you properly identify...

  • Just looked it up and the LM4F120 has a VOH of min. 2.4V where the NXP 74HCT595 and TI 74AHCT595 has a VIH of 2.0V. 

    And if speed at lower temp's will be a problem, there are many logic families to choose from, both at 3V3 and 5V. 

     

    It seems that he is clocking the HC595 at 100 KHz and then I would still prefer the I2C solution. 

  • Right you are - NXP spec (1st google) shows VIH (min) of 2.0V (w/typical @ 1.6V) for HCT device.  This @ IC's VCC of 4.5-5.5V.

    Based upon the character & amount of poster info - doubt that great thought went into 100KHz. 

    Freedom from "ACK/NAK" burden, potential to clock @ 10MHz, & cost - still pushes me in SPI direction.  And - w/addition of "PISO" IC - that same clock can deliver inputs as well as outputs.  (albeit - w/ connection between SPI_RX & added chip's serial output...)