I am trying to use the max7219 8x8 LED matrix using SPI bus.
I have done the following GPIO setup on Galileo board.
Digital pin     Function  Linux         Level shifter           Mux pins
                                        L: Dir_out H: dir_in
IO11            SPI MOSI    spidev1.0   gpio24                  gpio44(H)
                                                                gpio72(L)
IO12            gpio for
                Slave Sel   gpio15      gpio42                      -
IO13 SPI SCK spidev1.0 gpio30 gpio46(H)
I am setting the above gpio as follows -setting the mux pins as desired. -exporting gpio24, gpio 42, gpio30, gpio15 and setting the direction field as "OUT" and the value field as "0", -setting the gpio15 (slave select value) to "0".
I am using the following code to access the LED matrix and set a pattern:
int fd;
uint8_t array1[2];
uint8_t array [] = {    
        0x0F, 0x00,
        0x0C, 0x01,
        0x09, 0x00,
        0x0A, 0x01,
        0x0B, 0x07,
        0x01, 0x06,
        0x02, 0x06, };
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
static uint8_t mode;
static uint8_t bits = 8;
static uint32_t speed = 50000;
static uint16_t delay;
fd= open(DEVICE,O_RDWR);
struct spi_ioc_transfer tr = 
    {
        .tx_buf = (unsigned long)array1,
        .rx_buf = 0,
        .len = ARRAY_SIZE(array1),
        .speed_hz = speed,
        .bits_per_word = bits,
        .cs_change = 1,
    };
array1[0] = array [i];
array1[1] = array [i+1];
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
            if(ret<0)
                {
                    printf("ioctl Failed\n");
                }
        usleep(500000);
        close (fd);
 
    