www.beck-ipc.comwww.beck-ipc.com  | ImprintImprint
FAQFAQ  | SearchSearch  |

SPI on SC145

Questions and discussions about the operating system RTOS-LNX and the corresponding C-LIB.

SPI on SC145

Postby telemetrix » 13.02.2019, 23:07

Do you have example for SPI communication , MCP23s17 exampleis not clear.
I'm connect one 24bit A/D conv. REF AD7799 on SPI0 ( PIO21 for CLK, PIO123 MOSI, PIO124 MISO)

SPI_LEGACY_BUS (Idx) is 0 ?

Init sequence is only ? :

spiInit ( Idx, 0, 40); // vitesse SPI

( with SC23 is work with "spi_init_hw(0, 40);" init cod )

Pull up resistor needed ?

Re: SPI on SC145

Postby Andre Pribil » 14.02.2019, 09:11



Is PIO21 a typo? For the SPI1 interface, which you probably like to use here, the SCLK1 signal is PIO121. PIO21 would be SCLK3 on the SPI3 interface.

spiInit ( Idx, 0, 40)

Please note that the interpretation of the last parameter has changed. On the SC2x it was a divider of the SPI clock. For the RTOS-LNX it is the maximum clock rate.

So the value 40 would be something as 1170731 Hz, wheras on the SC1x5 it would be 40 Hz, which is probably way to low.


This define is only needed if you call the legacy API functions, which have no SPI interface index. The value 0 would select the SPI1 interface.

Best regards,
André Pribil
Software Development
Beck IPC GmbH

Re: SPI on SC145

Postby telemetrix » 16.02.2019, 13:12

Many thanks André

i use folowing code for I2C init :

#define SPI_LEGACY_BUS 0
#define SPI_MODE 0
#define SPI_CLK 100000 ( 100 khz it s beter for seeing with osciloscope )
int SPI_Idx=SPI_LEGACY_BUS; // numéro de port SPI
spiInit ( SPI_Idx, SPI_MODE, SPI_CLK ); // vitesse SPI

must use "pfe_enable_pio" or other commands before?

Re: SPI on SC145

Postby telemetrix » 16.02.2019, 14:41

It's work fine after lunch !
I'm cros MISO and MOSI
- MOSI is output for SC145
MISO is input

Return to RTOS-LNX

Who is online

Users browsing this forum: No registered users and 0 guests