Mbed-os: SSEL not working on STM32F NUCLEO_F767ZI

Created on 26 May 2019  路  9Comments  路  Source: ARMmbed/mbed-os

Description

Target: NUCLEO_F767ZI
Toolchain: GCC_ARM
Tools: mbed-cli 1.8.3
mbed-os: 73f096399b

I'm bringing up a new board and a simple testcase seems to find an issue with the SPI master. I'm not seeing the SSEL line be asserted/deasserted. I've found other STM32F HAL bugs around SPI but this seems like something basic that would have been caught. Am I doing something wrong?

Shareef.

include "mbed.h"

DigitalOut led(LED1);
Ticker tick;
SPI spi(PA_7, PA_6, PA_5, PA_4); // MOSI, MISO, SCK, SSEL
Serial uart(USBTX, USBRX);

void toggle(void) {
led = !led;
}

int main() {

led = 0;
tick.attach(&toggle, 2.0);

spi.format(8,3);
spi.frequency(1000000);

//spi.select();

while(1) {
//spin
spi.select();
spi.write(0xAA);
spi.deselect();
}
}

Issue request type


[ ] Question
[ ] Enhancement
[X] Bug

CLOSED mirrored bug

All 9 comments

@sjalloq is SSEL continuously high or low ?
Also may you add a wait in the spin loop to make sure you're not missing the assert/deassert ?

@sjalloq if you have logic analyzer , also useful to paste screenshot with signals - what is happening on the bus.

I've just captured two views on my scope that show MOSI on the first shot toggling and then SSEL stuck low. According to your pin list on the F767 page, SSEL is on pin PA_4 which is one up from the bottom left of CN7.

The code is slightly different now and I'm using the spi.transfer() function to send a buffer.

Cheers, Shareef.

MOSI
SSEL

Hi,

I have submitted a new PR to fix this issue : #10708.
A setting was missing in our implementation.

Then, as I mentioned in the PR, be careful, this feature is not compatible with all SPI modes. It will work only in modes 0 and 2. See "NSS pulse mode" chapter in our reference manual. (link for L4 as example)

What I have now :
image

@sjalloq it means you have to change your code to
spi.format(8,0);
or
spi.format(8,2);

Thanks. I'll give it a go when I get a chance.

PR submitted.

@linlingao
Why did you close the issue?
Issue is used to be closed when the patch is merged, which is not the case for #10708

@0xc0170

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bcostm picture bcostm  路  4Comments

drahnr picture drahnr  路  4Comments

pilotak picture pilotak  路  3Comments

chrissnow picture chrissnow  路  4Comments

ghost picture ghost  路  4Comments