bouffalolab / bouffalo_sdk

BouffaloSDK is the IOT and MCU software development kit provided by the Bouffalo Lab Team, supports all the series of Bouffalo chips. Also it is the combination of bl_mcu_sdk and bl_iot_sdk
Apache License 2.0
362 stars 128 forks source link

[fix][dma] fix index in dma2_isr for dma_callback #184

Closed vitfen closed 10 months ago

vitfen commented 10 months ago

Interrupt handeling for DMA2 on D0 ether crashes with 'Instruction access fault' or does not get handled at all. (Depends on the used bflb_device_s.idx value.)

With this patch this will be fixed. Also I had to reset the chip to recover and could than observe the expected behaviour.

For testing I used this device structure

struct bflb_device_s dev_desc_dma2_ch0 = {
    .name = "dma2_ch0",
    .reg_base = DMA2_BASE + 1 * DMA_CHANNEL_OFFSET,
    .irq_num = DMA2_INT0_IRQn,
    .idx = 2,
    .sub_idx = 0,
    .dev_type = BFLB_DEVICE_TYPE_DMA,
    .user_data = NULL
};
sakumisue commented 10 months ago

Thanks for your pr.