Need Help with SPI1

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
ep.hobbyiest
Posts: 94
Joined: Sun Jun 26, 2016 5:22 pm
Has thanked: 4 times
Been thanked: 1 time

Need Help with SPI1

Post by ep.hobbyiest »

Hi,
I am using STM32F103c8t6 and NRF24L01 rf module.
I am using PA4, PA5, PA6, PA7 pins for SPI.(PA4 - Chip Select).

I am refering code but in that code Software SPI was implemented.
While using code in RX mode it is getting stuck some where. Not able to communicate properly.
Here is PIN Configuration i am using

Code: Select all

#define NRF_PORT_CSN            GPIOA
#define NRF_PORT_SCK            GPIOA
#define NRF_PORT_MOSI           GPIOA
#define NRF_PORT_MISO           GPIOA
#define NRF_PORT_IRQ            GPIOB
#define NRF_PORT_CE            GPIOB

#define NRF_PIN_CSN             4
#define NRF_PIN_SCK             5
#define NRF_PIN_MISO            6
#define NRF_PIN_MOSI            7
#define NRF_PIN_IRQ             1
#define NRF_PIN_CE              0


Here is code i am using.
https://github.com/devstm32/nrf24l01

I think problem is while reading SPI register but not able to figure out exact problem.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Need Help with SPI1

Post by Giovanni »

Are the pin assignable to SPI1? not all pins can be used, the table is on the Data Sheet.

Giovanni
ep.hobbyiest
Posts: 94
Joined: Sun Jun 26, 2016 5:22 pm
Has thanked: 4 times
Been thanked: 1 time

Re: Need Help with SPI1

Post by ep.hobbyiest »

Yes. SPI1 is functional. I could read and write data to NRF24L01 module.
And also i took reference from SPI example.

I have narrowwed down the problem. I am facing problem while Receiving only. I think i use spisend and spireceive one after another then this problem comes.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Need Help with SPI1

Post by Giovanni »

Do you perform select/unselect between operations? you may need to add time between an unselect and the next select, the driver does not do that for you.

If in doubt use a logic analyzer and look what's going on.

Giovanni
Post Reply