Skip to content

Conversation

soburi
Copy link
Owner

@soburi soburi commented Oct 11, 2025

Summary

  • set the sample's overlay explicitly and rename the LCD node to avoid conflicts with the SoC LCD_CAM block
  • build the SPI transaction descriptor manually with GPIO-based CS control since zephyr,spi-device lacks bindings for timing properties
  • enable SPI support in the sample configuration so the ESP32-S3 controller device is instantiated

Testing

  • west build -b m5stack_cores3/esp32s3/procpu samples/boards/espressif/m5stack_cores3_spi_lcd_raw --pristine -- -DZEPHYR_EXTRA_MODULES=/workspace/modules/hal/espressif

https://chatgpt.com/codex/tasks/task_e_68e9df8d58f08322bb11568167fe9534

The condition for setting the GPOMD bit when `port0_push_pull`
is enabled was reversed.
Fix this problem.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

/* send data */
spi_hal_user_start(hal);
spi_context_update_tx(&data->ctx, data->dfs, transfer_len_frames);
while (!spi_hal_usr_is_done(hal)) {
/* nop */
}
if (!cfg->dma_enabled) {
/* read data */
spi_hal_fetch_result(hal);
}
if (rx_temp) {
memcpy(&ctx->rx_buf[0], rx_temp, transfer_len_bytes);
}
spi_context_update_rx(&data->ctx, data->dfs, transfer_len_frames);

P1 Badge Adjust tx/rx context for unaligned frame sizes

After computing transfer_len_bytes for the active chunk, the code still calls spi_context_update_tx(&data->ctx, data->dfs, transfer_len_frames) and the equivalent for RX. data->dfs is DIV_ROUND_UP(dfs_bits, 8), so for a 9‑bit word data->dfs becomes 2 bytes even though the transfer only consumes ceil(frames * 9 / 8) bytes (e.g. 36 bytes for 32 frames). The context update therefore advances the buffer pointer by frames * data->dfs (64 bytes in the example), skipping the remainder of the bit‑packed data and causing the rest of the message to be dropped. The new sample packs 9‑bit words densely, so any unaligned word size will transmit only part of the buffer. The update needs to use the actual byte count (transfer_len_bytes) when dfs_bits % 8 != 0 or the feature will corrupt transfers.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

@soburi soburi force-pushed the codex/add-3-wire-spi-support-for-esp32 branch from 643c3cb to 3583497 Compare October 11, 2025 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant