EVK1100 SPI peripheral selection

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I try to use LCD and dataFlash on EVK1100 and need some help. there is no simple example in SOFTWARE FRAMEWORK ( and control panel is far, far away from simple... ). there is another example MASS STORAGE without RTOS that do similar job - activate two peripheral ( dataFlash and SDMMC ) on SPI, but this example does not help me to resolve my problem, on contrary - it is source of my confusion. in SOFTWARE FRAMEWORK there is procedure spi_selectionMode and peripheral is activated in this way: spi_selectionMode(xx_xxx_SPI, 0, 0, 0); first parameter is obvious, second is PS ( if 0 then peripheral is FIXED ! ) and so on. how it comes ? I expected that PS field in MR register should be 1 if there is need for more than one peripheral on same SPI bus. but here I see ZERO ! in Control Panel example situation is even worse: there are LCD, dataFlash, SDMMC on same SPI bus ( works fine ) but I cant figure how ?

can you give me just a hint in plain english, what to do ? if PS field can be ZERO, how can I select another peripheral on same SPI ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

On an SPI, you select peripherals by setting the chip select line low. I ended up using the spare spi and left default cs pin as a dummy:

gpio_clr_gpio_pin(DEVICE1_CS_PIN);
spi_selectChip(SPARE_SPI, 0);

And then, only:

spi_write(xx_SPI, 0x20);

I didn't touch the SPI bus for on-board devices. I know this is not a complete or even a good explanation, but hopefully you get a step forward.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did not resolve my problem, but I learn something: if you put ZERO in PS flag in MR register, you have to switch on / off any SPI peripheral you used. in SOFTWARE FRAMEWORK I study dip204.c file - for LCD output - and realise that every LCD command start with dip204_select() and ended with dip204_unselect(). that is the way to switch between multiple peripheral ! it looks like I have to put something similar when I access dataFlash!

edit on 7 august:
finaly I found a solution. it is all in control panel sample. in MMI folder there is mmi.c file with prvMMI_init procedure, for LCD. initialization of flash is in main.c - in plain english: I don't understood nothing, nevertheless it works !