Skip to content

CH32V003 SPI slave receive only mode #218

@fulda1

Description

@fulda1

Hi,

is it possible to configure SPI to work as slave receiver?

I have master with two wires - clock and data. master send 8bit bytes in structure:
idle is low, data are valid on 2md edge, 8bit data.

I would like to use CH32003 as slave for this master.
it seems easy configuration by datasheet: SPI_CTLR1 = 0x06C1. Unfortunately I do not see how to done configuration like this using arduino library.
On the top it seems, that interrupt is not supported at all.

I have few questions as workarounds:

  1. how to configure pins to assign them to SPI? (default one)
  2. how to configure interrupt assigned to SPI to call my function?

Thank you

R16_SPI_CTLR1	// 0x40013000	SPI Control register1
	0000 0110 1100 0001 = 0x06C1
	                  1: Data sampling starts from the second clock edge.
	                 0: SCK is held low in idle state.
	                0: Configured as a slave device.
	            00 0: FHCLK /2;
	           1: Enable SPI.
	          1: LSB is transmitted first.
	        0: NSS is low.
	       1: Software control of the NSS pins.
	      1: Receive only, simplex mode.
	     0: Use 8-bit data length for sending and receiving.
	   0: Continue to send data from the data register.
	  0: CRC calculation is disabled.
	 0: Disable output, receive only.
	0: Selection of 2-line bi-directional mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions