Need Help with SPI1

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

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

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

Need Help with SPI1

Postby ep.hobbyiest » Tue Nov 28, 2017 5:24 pm

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: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Need Help with SPI1

Postby Giovanni » Tue Nov 28, 2017 7:01 pm

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

Postby ep.hobbyiest » Tue Nov 28, 2017 7:21 pm

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: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Need Help with SPI1

Postby Giovanni » Tue Nov 28, 2017 7:56 pm

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


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 13 guests