MBSP

Microcontroller Board Support Package

User Tools

Site Tools


configuration_json

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
configuration_json [ 18.04.2025 14:13] larsconfiguration_json [ 21.04.2025 12:14] (current) lars
Line 436: Line 436:
             "clock_phase": "sample_on_leading_edge",             "clock_phase": "sample_on_leading_edge",
             "bit_order": "msb_first",             "bit_order": "msb_first",
-            <del>frame_size: 8</del> +            "baud_rate": "10 MHz",
-            "baud_rate": "10Mhz", +
-            "crc": "enabled", +
-            "crc_polynomial": <del>7</del>+
         }         }
     }     }
Line 469: Line 466:
 **default**: master **default**: master
  
 +=== communication_mode ===
  
-  * //communication_mode: duplex//communication mode can be //duplex// (the traditional mode using MISO and MOSI to transmit and receive at the same time) or //half-duplex//, meaning the same wire between master MOSI and slave MISO is used for both directions. Unidirectional communication can be achieved by specifying //duplex// and connecting only MISO-to-MISO or MOSI-to-MOSI wires. See also //receive-only// below. +Describes the communication. Possible values are: 
-  *  +  * duplex : the traditional mode using MISO and MOSI to transmit and receive at the same time
-  * //receive-only// (RXOMEN in the F411) disables the transmission signal (MISO in slave mode, MOSI in master mode). According to the F411 manual, it is useful when communicating with multiple slaves to avoid data collisions (not completely clear to me;  avoids NSS signals for master-to-slave communication?+  * half-duplex meaning the same wire between master and slave is used for both directions. 
 +  * receive-only : send line is not used 
 +  * send-only : receive Line is not used.
  
-**DICUSS(Lars):** I assume they mean that you can use the unused pin for other usages/ do not read noise on the unconnected pin? Anyhow, A send only should also be given for symmetry. But then I think we have this double with the duplex / half duplex setting. So maybe consolidate those together?+**type**: enum
  
-**REPLY(Johan)** Half duplex is different from unidirectional communication.  See figures in APM32F411xCxE user manual v1.4 page 327. In half-duplex mode (what they call bidirectional mode), master-MOSI is connected to slave-MISO. In unidirectional mode, master-MOSI is connected to slave-MOSI or master-MISO is connected to slave-MISO,  depending on the desired direction.+**default**duplex
  
-**DICUSS(Lars):** " master-MOSI is connected to slave-MISO" AHHH. Why? That is just wrong!+=== frame_format ===
  
-**REPLY(Johan)** I agree: this is a bad idea. Unfortunately,  it is what they do in the F411 chipWhether you actually need to mkae that connection depends on the other device;  in the F411 settings,  it only means that half duplex communication uses MOSI in master mode and MISO in slave mode. Unidirectional receive-only uses MISO in master mode and MOSI in slave mode,  and vice-versa for transmit-only.  +Describes the communicationPossible values are: 
 +  * motorola : the "normal" SPI. 
 +  * ti : 
  
-Maybe we just need a setting to specify which pad should be used for half-duplex communication.+**type**: enum
  
-This whole //receive-only// setting is a bit obscure to me; shall we postpone it to a later version?+**default**: motorola
  
-  * //frame_format// can be //motorola// or //ti////ti// format has implications for clock polarity and phase and nss handling that are currently unclear;  we may need to figure this out and possibly replace this parameter by more explicit settings.+=== clock_polarity === 
 +Also often called CPOLDescribes the communication. Possible values are
 +  * idle_low 
 +  * idle_high
  
-  //clock_polarity////idle_low// or //idle_high// sets the clock level between transmissions of data. Also often called CPOL.+**type**enum
  
-  //clock_phase// sets the clock transition at which the data is sampled;  //sample_on_leading_edge// samples the data on the edge from idle value to non-idle value, and //sample_on_trailinging_edge// samples the data on the edge from non-idle value to idle value. Also often called CPHA.+**default**: idle_low
  
 +=== clock_phase ===
 +Also often called CPHA. Describes the communication. Possible values are:
 +  * sample_on_leading_edge : samples the data on the edge from idle value to non-idle value.
 +  * sample_on_trailinging_edge : samples the data on the edge from non-idle value to idle value.
 +
 +**type**: enum
 +
 +**default**: sample_on_leading_edge
 +
 +
 +=== SPI Mode ===
 Sometimes the documentation talks about a SPI Mode with the value of 0 to 3. This mode maps to the phase and polarity as described in the following table: Sometimes the documentation talks about a SPI Mode with the value of 0 to 3. This mode maps to the phase and polarity as described in the following table:
  
Line 500: Line 516:
 | 3 | 1 | 1 | clock: idle_high, phase: sample_on_trailing_edge | | 3 | 1 | 1 | clock: idle_high, phase: sample_on_trailing_edge |
  
-  * //bit_order// can be //msb_first// or //lsb_first// 
  
-  * //baud_rate// is the desired clock frequency during transmission. Code generation should try to approach it as closely as possible. Will there be a feedback mechanism to report the achieved (nominal) frequency? 
  
-**DICUSS(Lars):** What do you have in mind? How can the code generator provide feedback? Shall we define some sort of log file that goes into the zip with the generated code that you can read and check for things like this?+=== bit_order === 
 +Describes the communication. Possible values are: 
 +  msb_first : most significant bit first (bits on the line  76543210 ) 
 +  lsb_first : least significant bit first (bits on the line:  01234567 )
  
-**REPLY(Johan):** I am not sure yet.  My ideal for baud rate would be to show immediately in the UI what the closest achievable baud rate is. If that is not (yet) possible,  I would like at least to be able to show the actual baud rate in the UI. So some structured feedback would be useful;  maybe another json file in the generated code? It could also be useful to provide error feedback from code generation, e.g. if the requested parameters are not achievable. +**type**: enum
- +
-**DICUSS(Lars):** I added a report file to the list of generated files.(mbsp_report.txt) We probably then need a format for that also,... +
- +
-**REPLY(Johan):** Right, but probably not necessary for version 1. +
- +
-  * //crc//: //enabled// or //disabled//. The Geehy F411 SPI peripherals provide hardware for CRC generation and checking  +
- +
-**DICUSS(Lars):** I think that is something the driver layer should deal with. But not sure.  +
- +
-**REPLY(Johan):** CRC settings must match the expectations of the device +
- +
-  * //crc_polynomial//: an unsigned integer representing the polynomial to be used for CRC generation and checking. Do we need to specify the number of bits as well? +
- +
-**DICUSS(Lars):** The 7 has no meaning at all for me. We at least need the documentation that explains how to interpret the value. Also driver layer. Documentation can be a link to wikipedia or whatever.  +
- +
-**REPLY(Johan)** You are right. Wikipedia https://en.wikipedia.org/wiki/Cyclic_redundancy_check mentions four different notations to specify a polynomial for a CRC: normal, reversed, reciprocal and reversed reciprocal. They can be converted into each other, so we can choose one. The reciprocal versions have the advantage that you need to specify only a single number, not a separate length and value. Some standardized CRC algorithms have extra steps in addition to the core CRC calculation,  like prepending an initial value or xor-ing the final value with some constant. I assume that these steps are usually not implemented in hardware. Do we need to take that into account for code generation? +
- +
-**DICUSS(Lars):** can we move this to version 2? long answer: It depends. The CRC, as you said, depends on the device/communication partner. And that might expect some crazy initialization value and some Xor at the end or whatever. I would suggest to look at this from the use case perspective and find solutions for one use case after the other. That way these settings are derived from the use case and we do not depend on the user to provide consistent settings. Then we can also have a generic solution where the user has to give all the variables (initialization, Xor,..) and w then do exactly that and hope for the best. +
- +
-**REPLY(Johan)** Agreed: let's postpone this.  It is not essential for a demo, so we can even postpone it until after the demo. +
- +
-**REPLY(Johan)** How/where would you specify the parameters of the connected device? Many other SPI parameters specified here also depend on the connected device. For example clock polarity and phase and bit order must match the device's expectations. +
- +
-**DICUSS(Lars):** We could add explicit support for some devices. Then the user would just select the device and all the dependent settings (CPOL/CPHA,CRC, bits per transfer..) would be set accordingly. Does that make sense? +
- +
-**REPLY(Johan)** Does that mean that for supported devices,  you don't need an explicit SPI configuration?  That makes sense to me. I think we would still need an SPI configuration for unsupported devices; it will take some time before we can support all existing devices in the world :-) . It is OK for me to initially only provide SPI settings for unsupported devices without CRC; that can be added later. +
- +
-===== QSPI group ===== +
- +
-TBD +
- +
-===== SDIO group ===== +
- +
-TBD +
- +
-===== I2C group ===== +
- +
-TBD +
- +
- +
-===== I3C group ===== +
- +
-TBD +
- +
- +
-===== I2S group ===== +
- +
-TBD +
- +
- +
-===== CAN group ===== +
- +
-TBD +
- +
- +
-===== USB group ===== +
- +
-TBD +
- +
- +
-===== Watchdog group ===== +
- +
-TBD +
- +
-===== Random_Number group =====+
  
-TBD+**default**: msb_first
  
 +=== baud_rate ===
  
-===== CRC group =====+Is the number of bits per second exchanged on the data lines. Expressed as frequency of the clock line.
  
-TBD+**type**: int (Hz)
  
configuration_json.txt · Last modified: by lars