artemopolus opened a new issue #1659: URL: https://github.com/apache/incubator-nuttx/issues/1659
I am interesting about Nuttx for implementing in our device. Now we use FreeRTOS on stm32f103cb6, but it's interesting for us to port our software on Nuttx. Basic question is how to add spi half duplex driver in this OS. We have sensor which is working on half duplex spi wire. We found spi_bus_initialize function, but there is no necessary function in this file. What is the best way to implement this driver in OS? Current code perfectly work on FreeRTOS: Using register we need this for spi base configring: #define WRITE_REG(REG, VAL) ((REG) = (VAL)) #define READ_REG(REG) ((REG)) #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) RCC->APB2ENR |= RCC_APB2ENR_SPI1EN; MODIFY_REG(SPI1->CR1, SPI_CR1_BR, (SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0)); set_halfduplexTX_lsm303ah(); MODIFY_REG(SPI1->CR1, SPI_CR1_CPHA, SPI_CR1_CPHA); MODIFY_REG(SPI1->CR1, SPI_CR1_CPOL, SPI_CR1_CPOL); MODIFY_REG(SPI1->CR1, SPI_CR1_DFF, 0x00000000U); MODIFY_REG(SPI1->CR1, SPI_CR1_SSM, SPI_CR1_SSM); MODIFY_REG(SPI1->CR2, SPI_CR2_SSOE, ((uint32_t)(SPI_CR1_SSM >> 16U))); MODIFY_REG(SPI1->CR1, SPI_CR1_MSTR | SPI_CR1_SSI, (SPI_CR1_MSTR | SPI_CR1_SSI)); Later, we need to activate spi Later, we need switch direction of data transfer on spi data line -- With best regards, Kuznetcov Artem ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org