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

fix(Examples)!: Require DMA Channel as Input Argument for ADC DMA Conversions, Fix ADC DMA Transfer Bug for Channels > 0 #643

Merged
merged 9 commits into from
Jul 11, 2023

Conversation

Vignesh-VVadivel
Copy link
Contributor

@Vignesh-VVadivel Vignesh-VVadivel commented Jun 28, 2023

Fixed the DMA transfer over multiple channels for ADC example in the MAX32672 board, and the corresponding JIRA ticket is here

This PR contains the fix for all example codes that uses ADC Rev B, which includes MAX32662, MAX32672, MAX32690, MAX78002.

@@ -246,6 +246,7 @@ typedef struct {
mxc_adc_avg_t avg_number; ///< no of samples to average
mxc_adc_div_lpmode_t lpmode_divder; ///< Divide by 2 control in lpmode
uint8_t num_slots; ///< num of slots in the sequence
int8_t dma_channel; ///< DMA channel number for DMA transfer
Copy link
Contributor

Choose a reason for hiding this comment

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

We should consider updating this comment to say that users should call MXC_DMA_AcquireChannel to assign the value for this field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated that comment in the code.

@@ -214,7 +214,7 @@ int MXC_ADC_RevB_StartConversionDMA(mxc_adc_revb_regs_t *adc, mxc_adc_conversion

num_bytes = (req->num_slots + 1) * 4; //Support 8 slots (32 bytes) only. (TODO)

channel = MXC_DMA_AcquireChannel();
channel = req->dma_channel;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change will break builds for the other chips which use ADC Rev. B. If we proceed with this implementation these changes will need to be applied to the ME12 and ME18 as well.

Copy link
Contributor Author

@Vignesh-VVadivel Vignesh-VVadivel Jul 5, 2023

Choose a reason for hiding this comment

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

Yup sure,
I updated these changes for both ME12 and ME18.
I have also implemented these changes for MAX78002, since it uses ADC Rev B.

@@ -202,6 +202,7 @@ typedef struct {
mxc_adc_avg_t avg_number; ///< no of samples to average
mxc_adc_div_lpmode_t lpmode_divder; ///< Divide by 2 control in lpmode
uint8_t num_slots; ///< num of slots in the sequence
int8_t dma_channel; ///< User should call MXC_DMA_AcquireChannel() to assign DMA Channel number
Copy link
Contributor

@Jake-Carter Jake-Carter Jul 5, 2023

Choose a reason for hiding this comment

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

I would suggest changing this comment to indicate that the field is ignored for non-DMA transactions.

///<The channel to use for DMA-enabled transactions.  Users should call \ref MXC_DMA_AcquireChannel to assign the DMA channel number.  For non-DMA transactions, this field is ignored.

It looks like we also need to improve our Doxygen headers for the TransactionDMA function in general (see here). Can you improve the adc.h files to fix the following issues?

  1. The Doxygen for mxc_adc_req_t is broken (no link/documentation generated)
  2. Update the MXC_ADC_StartConversionDMA function brief to inform the user that they must acquire a DMA channel and pass it in via the "req" input struct
  3. Update the MXC_ADC_StartConversionDMA function brief to inform the user that they must enable the correct DMA IRQ call the MXC_DMA_Handler function from the ISR.
  4. Add a "Detailed Description" section for the adc.h file

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jul 6, 2023
Copy link
Contributor

@Jake-Carter Jake-Carter left a comment

Choose a reason for hiding this comment

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

Thanks @Vignesh-VVadivel,

Final task for you on this: mxc_adc_req_t and mxc_adc_slot_req_t are also missing Doxygen @brief sections for:

  • MAX32662 adc.h
  • MAX32672 adc.h
  • MAX32690 adc.h
  • MAX78002 adc.h

We should add them so that these structs also show up in the structs section:
image

@sihyung-maxim sihyung-maxim changed the title fix(Examples): MSDK-1218 Fix DMA transfer over multiple channels for ADC example fix(Examples): MSDK-1218: Fix DMA transfer over multiple channels for ADC example Jul 10, 2023
@Vignesh-VVadivel Vignesh-VVadivel added the bug Something isn't working label Jul 11, 2023
Copy link
Contributor

@Jake-Carter Jake-Carter left a comment

Choose a reason for hiding this comment

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

Looks good, thanks

@Jake-Carter Jake-Carter added MAX32672 Related to the MAX32672 (ME21) MAX32690 Related to the MAX32690 (ME18) MAX78002 Related to the MAX78002 (AI87) MAX32662 Related to the MAX32662 (ME12) labels Jul 11, 2023
@Jake-Carter Jake-Carter changed the title fix(Examples): MSDK-1218: Fix DMA transfer over multiple channels for ADC example fix(Examples)!: Require DMA Channel as Input Argument for ADC DMA Conversions, Fix ADC DMA Transfer Bug for Channels > 0 Jul 11, 2023
@github-actions github-actions bot removed the MAX32672 Related to the MAX32672 (ME21) label Jul 11, 2023
@github-actions github-actions bot removed MAX32690 Related to the MAX32690 (ME18) MAX78002 Related to the MAX78002 (AI87) MAX32662 Related to the MAX32662 (ME12) labels Jul 11, 2023
@Jake-Carter Jake-Carter added API Change This issue or pull request involves a change to the current MSDK API MAX32672 Related to the MAX32672 (ME21) MAX32690 Related to the MAX32690 (ME18) MAX78002 Related to the MAX78002 (AI87) MAX32662 Related to the MAX32662 (ME12) labels Jul 11, 2023
@Jake-Carter Jake-Carter merged commit 2b10962 into analogdevicesinc:main Jul 11, 2023
Jake-Carter pushed a commit to Jake-Carter/msdk that referenced this pull request Jul 16, 2023
Jake-Carter pushed a commit to Jake-Carter/msdk that referenced this pull request Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Change This issue or pull request involves a change to the current MSDK API bug Something isn't working documentation Improvements or additions to documentation MAX32662 Related to the MAX32662 (ME12) MAX32672 Related to the MAX32672 (ME21) MAX32690 Related to the MAX32690 (ME18) MAX78002 Related to the MAX78002 (AI87)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants