hey everybody,
i would like to connect 2 sensors to my lpc11u68. i connected one of them via IOCON SSP1_SEL but i want to connect the other one via a GPIO. Does anyone know how to do that ?
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 22, (IOCON_FUNC3 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); // MISO
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 21, (IOCON_FUNC2 | IOCON_MODE_INACT)); // MOSI
Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 20, (IOCON_FUNC2 | IOCON_MODE_INACT)); // SCK
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 12, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); // SSEL
Chip_SSP_Init(LPC_SSP);
ssp_format.frameFormat = SSP_FRAMEFORMAT_SPI;//SSP_FRAMEFORMAT_SPI
ssp_format.bits = SSP_BITS_8;
ssp_format.clockMode = SSP_CLOCK_MODE3;
Chip_SSP_SetFormat(LPC_SSP1, ssp_format.bits, ssp_format.frameFormat, ssp_format.clockMode);
Chip_SSP_Set_Mode(LPC_SSP1, SSP_MODE_MASTER);
Chip_SSP_SetBitRate(LPC_SSP1, SENSOR_SPI_BITRATE);
Chip_SSP_Enable(LPC_SSP1);
Please don't forget to set up the direction of the pin to be output pin and set it high as default.
Chip_GPIO_SetPinDIROutput()
Chip_GPIO_SetPinState()
I hope this helps,
Regards
Sol
Hi,
i tried to used the solution in the posted thread, but it didn't seem to work.
The Problem i try to solve is to use PIO_12 as SSP1_SSEL. as you can see PIO_23 column 5 is used normally for the CS.
I also tried to to set PIO_12 to LOW manually in the Code, but that doesn't seem to work neither.
Do you have any hint for my, how I could solve that Problem ?
Could you please share the configuration for PIO0_12 you are using?
Regards
Sol
Hi,
Please check the following thread and let me know if this helps.
Howto: 20-bit SPI transfer using SSP?
Have a nice day!
Regards
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------