-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Rx f low #20731
base: main
Are you sure you want to change the base?
Rx f low #20731
Conversation
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 0720d3ca57c60bb813d4f8e14826b7e827c071f2 more detailssdk-nrf:
Github labels
List of changed files detected by CI (8)
Outputs:ToolchainVersion: 4ffa2202d5 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
You can find the documentation preview for this PR here. |
3b6d9cf
to
3a72ed1
Compare
7d6bc30
to
27c9038
Compare
22b33e4
to
3970be6
Compare
3d7957c
to
2499e70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed during meeting
5278151
to
6b7ac9f
Compare
2b7e509
to
f160adf
Compare
include/drivers/mspi/nrfe_mspi.h
Outdated
@@ -96,6 +96,7 @@ typedef struct { | |||
|
|||
typedef struct { | |||
nrfe_mspi_opcode_t opcode; /* Same as application's request. */ | |||
uint32_t reserved : 24; /* Reserved in order to align data to 32 bits. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this will work correctly without the __packed
attribute on every compiler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed opcode to be uint32_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cnahged nrfe_mspi_opcode_t size to 32 bits
drivers/mspi/mspi_nrfe.c
Outdated
@@ -731,7 +745,7 @@ static int nrfe_mspi_init(const struct device *dev) | |||
.callback = flpr_fault_handler, | |||
.user_data = NULL, | |||
.flags = 0, | |||
.ticks = counter_us_to_ticks(flpr_fault_timer, CONFIG_MSPI_NRFE_FAULT_TIMEOUT) | |||
.ticks = counter_us_to_ticks(flpr_fault_timer, CONFIG_MSPI_NRFE_FAULT_TIMEOUT), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use auto formatting on the whole file. Only use it on the parts of the file that you have changed.
-> The rule is to not add such unnecessary changes to the PR. In the long run it disrupts/makes it harder to merge the whole file with the code of others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
include/drivers/mspi/nrfe_mspi.h
Outdated
nrfe_mspi_opcode_t opcode; /* Same as application's request. */ | ||
unsigned reserved : 24; /* Reserved to ensure proper alignment of data field. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nrfe_mspi_opcode_t opcode; /* Same as application's request. */ | |
unsigned reserved : 24; /* Reserved to ensure proper alignment of data field. */ | |
nrfe_mspi_opcode_t opcode : 32; /* Same as application's request. */ |
What about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not compile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm, it does not compile due to the added short-enums
compiler flag. Another solution is to use a union. This is a transparent solution, and it causes the field size to be correct and the data
is shifted by 32 bits.
typedef struct {
union {
nrfe_mspi_opcode_t opcode; /* Same as application's request. */
unsigned : 32;
};
uint8_t data;
} nrfe_mspi_flpr_response_msg_t;
But I think the least intrusive thing to do would be to simply add the value NRFE_MSPI_OPCODES_MAX = 0xFFFFFFFF
at the end of nrfe_mspi_opcode_t
, which would force the enum size to 32bits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed using this solution: NRFE_MSPI_OPCODES_MAX = 0xFFFFFFFF
dac73d9
to
de9df28
Compare
applications/sdp/mspi/src/hrt/hrt.c
Outdated
/* This is to avoid writing outside of data buffer in case when buffer_length%4 != | ||
* 0. | ||
*/ | ||
switch (NRFX_CEIL_DIV(last_word_bits - penultimate_word_shift, BITS_IN_BYTE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs default
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed switch to for
applications/sdp/mspi/src/hrt/hrt.c
Outdated
if ((penultimate_word_shift != 0) && (i > 1)) { | ||
penultimate_word = data[i - 2]; | ||
|
||
penultimate_word = (penultimate_word >> (penultimate_word_shift)) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
penultimate_word = (penultimate_word >> (penultimate_word_shift)) | | |
penultimate_word = (penultimate_word >> penultimate_word_shift) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
applications/sdp/mspi/src/hrt/hrt.c
Outdated
uint32_t last_word = 0; | ||
uint32_t penultimate_word = 0; | ||
uint16_t prev_out = 0; | ||
uint16_t cnt0 = 0; | ||
uint16_t cnt0_prev = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be only declared here and defined later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
applications/sdp/mspi/src/hrt/hrt.c
Outdated
|
||
/* Wait for reception to end, transfer has to be stopped "manualy". | ||
* Setting SHIFTCTRLB cannot be used because with RTPERIPHCTRL:STOPCOUNTERS == 1, | ||
* counter stops 1 clock to early. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* counter stops 1 clock to early. | |
* counter stops 1 clock too early. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
applications/sdp/mspi/src/main.c
Outdated
#define STD_PAD_BIAS_CNT0_THRESHOLD 1 /* 32MHz */ | ||
#define RX_CNT0_MIN_VALUE 2 /* 21.333333MHz */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments describing those defines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can limit the max possible freq to 21 MHz on the APP side, but can be left as is for now.
drivers/mspi/mspi_nrfe.c
Outdated
memcpy((void *)packet->data_buf, (void *)ipc_receive_buffer, ipc_received); | ||
if (packet->dir == MSPI_RX) { | ||
#ifdef CONFIG_MSPI_NRFE_IPC_NO_COPY | ||
/* Not aligned buffer. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please describe in comment how this is different from alignment done above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
applications/sdp/mspi/src/main.c
Outdated
#define STD_PAD_BIAS_CNT0_THRESHOLD 1 /* 32MHz */ | ||
#define RX_CNT0_MIN_VALUE 2 /* 21.333333MHz */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can limit the max possible freq to 21 MHz on the APP side, but can be left as is for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, just the recent changes need to be pushed.
Modified hrt rx flow to use write function for command, address and dummy cycles. Modified Rx function to work in 32 bit mode instead of 8 bit. Signed-off-by: Michal Frankiewicz <michal.frankiewicz@nordicsemi.no>
Modified return buffer alignment. Signed-off-by: Michal Frankiewicz <michal.frankiewicz@nordicsemi.no>
Added no copy functionality to RX. Signed-off-by: Michal Frankiewicz <michal.frankiewicz@nordicsemi.no>
Added no copy functionality to RX. Signed-off-by: Michal Frankiewicz <michal.frankiewicz@nordicsemi.no>
Increased partition size for flipper code. Signed-off-by: Michal Frankiewicz <michal.frankiewicz@nordicsemi.no>
Increased partition size for flipper code. Signed-off-by: Michal Frankiewicz <michal.frankiewicz@nordicsemi.no>
|
depends on #20602