Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI driver structure for L0 L1 F0 F1 F2 F4 #740

Closed
SevenW opened this issue Jan 20, 2017 · 7 comments
Closed

SPI driver structure for L0 L1 F0 F1 F2 F4 #740

SevenW opened this issue Jan 20, 2017 · 7 comments

Comments

@SevenW
Copy link
Contributor

SevenW commented Jan 20, 2017

I am in the process of adding a STM32 L0 SPI driver. Once done, I like to make a pull request. I see a lot of similarity among the L's and F's, and now I am seeking advice on structuring the files, I compared "SPI register map" tables from various STM32 reference manuals. Compared to starting with spi_common_all.h the following types of STM32 add capabilities:

common_all < F1 < {L0, L1, F2, F4}
and:
common_all < F1 < F0 (this adds other functionality then the above)

Note: some low budget mcu's F100, F0x0 have fewer registers then common_all. Missing two full registers (not only bits).

Observation on current implementation:
common_all < L1F124 < F24

What I want to do is separate out L1 and make a common L01F24

Please advice on the naming of the spi_common_*.h

@SevenW SevenW changed the title SPI driver structure fro L0 L1 F0 F1 F2 F4 SPI driver structure for L0 L1 F0 F1 F2 F4 Jan 20, 2017
@fenugrec
Copy link
Contributor

As I understand, I think the current direction is to drop the "L1F124" naming when it gets to a certain point of complexity. ADC and USB do this by grouping into arbitrary "versions", such as "st_usbfs_v1" and "st_usbfs_v2".

What are the registers "missing" from the low-end F1 and F0x0 chips you mention ?

(note, I'm mostly a spectator in this project, I don't make decisions ! )

@SevenW
Copy link
Contributor Author

SevenW commented Jan 23, 2017

I was in doubt on the _v2 naming convention. In two cases, the _v2 suffix is an addition to the original _common_all (adc, usbfs) and in one case it is a full replacement (usart).
Looking at this it seems appropriate to give the F1 version the name spi_common_v2.h

I will come back to the "reduced function" F1 and F0.

@SevenW
Copy link
Contributor Author

SevenW commented Jan 23, 2017

Missing from value line F0x0 and F100, with respect to other F0/F1:

register 0x1c: SPIx_I2SCFGR
register 0x1e: SPIx_I2SPR
flag b2: CHSIDE from register 0x08:SPIx_SR
flag b3: UDR from register 0x08:SPIx_SR

@karlp
Copy link
Member

karlp commented Jan 23, 2017

it was my understanding that all L0 chips have the "spi v2+" peripheral, with the fifos, that comes in with f3 and f0. There's probably not a lot you want to try and get too common. Are you sure there's not a PR for spi on l0 already?

@SevenW
Copy link
Contributor Author

SevenW commented Jan 23, 2017

Is a PR a github "issue"? Could not find it.
I also could not find a pull request.

I have prepared and tested a L0 implementation. It is not a lot of change. I try to prepare a pull request tonight. (The only open question for me: should I rename spi_common_l1.h to spi_common_v2.h?)

@SevenW
Copy link
Contributor Author

SevenW commented Jan 23, 2017

A preview on my intended delta can be found here:
master...SevenW:stm32spi

grevaillot added a commit to grevaillot/libopencm3 that referenced this issue Apr 4, 2018
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
grevaillot added a commit to grevaillot/libopencm3 that referenced this issue Apr 4, 2018
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
grevaillot added a commit to grevaillot/libopencm3 that referenced this issue Apr 4, 2018
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
grevaillot added a commit to grevaillot/libopencm3 that referenced this issue Apr 5, 2018
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
karlp pushed a commit to karlp/libopencm3 that referenced this issue Apr 16, 2018
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
karlp pushed a commit to karlp/libopencm3 that referenced this issue Apr 27, 2018
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
karlp pushed a commit that referenced this issue Apr 28, 2018
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
@karlp
Copy link
Member

karlp commented Apr 28, 2018

tot he best of my knowledge this is closed now. new or extra or missing portions should come in as new tickets please.

@karlp karlp closed this as completed Apr 28, 2018
abhisit pushed a commit to abhisit/libopencm3 that referenced this issue Aug 15, 2018
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
BOJIT pushed a commit to BOJIT/PlatformIO-libopencm3 that referenced this issue Jan 30, 2021
split spi stuff in three part:
 - v1 : basic spi peripheral
 - v1_frf : v1 spi with frf mode additional bit in spi_cr2 / spi_sr
 - v2 : spi with variable datasize, fifo and other fancy stuff.

v1 maps to f1 chips
v1_frf to f2, f4 and l0,l1
v2 to f0, f3 and l4

This breaks spi_master_init API for v2 devices : function prototype from
common spi header used to be abused, with DFF bit reused for CRCL bit.
New v2 spi_master_init does not handle anymore CRCL bits, as it does not
usually mess with other crc configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants