2021-04-07 23:31:59 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
2022-10-02 15:29:17 +01:00
|
|
|
#include <string>
|
2021-04-07 23:31:59 +01:00
|
|
|
|
2022-10-02 15:29:17 +01:00
|
|
|
#include "src/DebugToolDrivers/Microchip/EdbgDevice.hpp"
|
2021-04-07 23:31:59 +01:00
|
|
|
|
2023-11-18 23:50:08 +00:00
|
|
|
namespace DebugToolDrivers::Microchip
|
2021-04-07 23:31:59 +01:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The MPLAB Snap device is a hybrid device - that is, it can present itself as an "MPLAB Snap ICD" device, as well
|
2022-10-02 15:29:17 +01:00
|
|
|
* as an EDBG (Embedded Debugger) device. The device switches between these two modes via firmware configuration.
|
|
|
|
|
* It appears that it can only interface with AVR targets using the EDBG firmware, which, apparently, is why it is
|
|
|
|
|
* known to be in "AVR mode" when it presents itself as an EDBG device.
|
2021-04-07 23:31:59 +01:00
|
|
|
*
|
|
|
|
|
* This debug tool driver currently only supports the device when in AVR mode. Because the device uses different
|
2022-10-02 15:29:17 +01:00
|
|
|
* USB vendor and product IDs depending on the mode, it is trivial to determine which is which. In fact, Bloom will
|
|
|
|
|
* not even recognise the device if it's not in AVR mode.
|
2021-04-07 23:31:59 +01:00
|
|
|
*
|
2025-01-07 23:31:48 +00:00
|
|
|
* USB (when in Avr/EDBG mode):
|
2021-04-07 23:31:59 +01:00
|
|
|
* Vendor ID: 0x03eb (1003)
|
|
|
|
|
* Product ID: 0x2180 (8576)
|
|
|
|
|
*/
|
2022-10-02 15:29:17 +01:00
|
|
|
class MplabSnap: public EdbgDevice
|
2021-04-07 23:31:59 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2022-10-02 15:29:17 +01:00
|
|
|
static const inline std::uint16_t USB_VENDOR_ID = 0x03eb;
|
|
|
|
|
static const inline std::uint16_t USB_PRODUCT_ID = 0x2180;
|
|
|
|
|
static const inline std::uint8_t CMSIS_HID_INTERFACE_NUMBER = 0;
|
2021-04-07 23:31:59 +01:00
|
|
|
|
2024-12-30 15:41:52 +00:00
|
|
|
static const inline std::uint16_t PIC_MODE_USB_VENDOR_ID = 0x04d8;
|
|
|
|
|
static const inline std::uint16_t PIC_MODE_USB_PRODUCT_ID = 0x9018;
|
|
|
|
|
static const inline std::uint16_t BL_MODE_USB_PRODUCT_ID = 0x9019;
|
2023-05-07 16:44:15 +01:00
|
|
|
|
Made the EDBG CMSIS-DAP command delay optional for all debug tools, and disabled it by default.
The command delay was really choking Bloom's EDBG driver, causing a very noticeable drag on Bloom's performance. It's much faster with the command delay disabled.
There was a good reason for why I introduced this some time ago. Without it, some EDBG debug tools were misbehaving - I remember that for certain. But now, I cannot seem to reproduce these issues. Very odd.
If the issues do reappear, I may have to enable the command delay by default, again, for some debug tools.
For now, if any users experience issues, I'll just suggest they manually enable the command delay via their project config.
Also, I'm not going to document this new config option, as I would prefer the user to approach me if they experience issues as a result of this, so that I'll know if it needs revisiting.
2024-10-27 00:25:42 +01:00
|
|
|
MplabSnap(const DebugToolConfig& debugToolConfig);
|
2021-04-07 23:31:59 +01:00
|
|
|
|
|
|
|
|
std::string getName() override {
|
|
|
|
|
return "MPLAB Snap";
|
2022-10-01 16:50:57 +01:00
|
|
|
}
|
2023-05-07 16:44:15 +01:00
|
|
|
|
|
|
|
|
void init() override;
|
2023-05-21 21:08:25 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void configureAvr8Interface() override;
|
2021-04-07 23:31:59 +01:00
|
|
|
};
|
|
|
|
|
}
|