diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index aa571633610e6a8a86e419462907d728a6d4bbef..638d8a119bbb01780a06bee72d636452ae3454ba 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -9,6 +9,8 @@ * \section Sec_ChangeLogXXXXXX Version XXXXXX * <b>New:</b> * - Added new ADC_DisableChannel() function (thanks to Mich Davis) + * - Added new VTARGET_REF_VOLTS and VTARGET_SCALE_FACTOR compile time defines to the AVRISP-MKII programmer project to set + * the VTARGET reference voltage and scale factor * * <b>Changed:</b> * - The RingBuff library code has been replaced in the XPLAINBridge, Benito and USBtoSerial projects with an ultra lightweight @@ -26,6 +28,7 @@ * instead of the split write-only command (thanks to Tim Margush) * - Fixed RNDISEthernet demos crashing when calculating checksums for Ethernet/TCP packets of more than ~500 bytes due to * an overflow in the checksum calculation loop (thanks to Kevin Malec) + * - Fixed XPLAINBridge project not correctly reading the XMEGA's supply voltage when reporting back to the host * * \section Sec_ChangeLog100513 Version 100513 * <b>New:</b> diff --git a/Projects/AVRISP-MKII/AVRISP.c b/Projects/AVRISP-MKII/AVRISP.c index e26d16c4c875c66be51bd729d37bcb0934282b4a..81c1385c911d2499b8cbc7c2939b534899976014 100644 --- a/Projects/AVRISP-MKII/AVRISP.c +++ b/Projects/AVRISP-MKII/AVRISP.c @@ -49,7 +49,6 @@ int main(void) for (;;) { Process_AVRISP_Commands(); - V2Params_UpdateParamValues(); USB_USBTask(); diff --git a/Projects/AVRISP-MKII/AVRISP.txt b/Projects/AVRISP-MKII/AVRISP.txt index ab4472d9c7a2b5b46a9f5fcb5261114427b72c7a..de08d5f37968ec598e072019c2a94f6b56ad07e3 100644 --- a/Projects/AVRISP-MKII/AVRISP.txt +++ b/Projects/AVRISP-MKII/AVRISP.txt @@ -262,6 +262,21 @@ * targets lacking an ADC.</i></td> * </tr> * <tr> + * <td>VTARGET_REF_VOLTS</td> + * <td>Makefile CDEFS</td> + * <td>Indicates the programmer AVR's AVCC reference voltage when measuring the target's supply voltage. Note that the supply + * voltage should never exceed the reference voltage on the programmer AVR without some form of protection to prevent damage + * to the ADC. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td> + * </tr> + * <tr> + * <td>VTARGET_SCALE_FACTOR</td> + * <td>Makefile CDEFS</td> + * <td>Indicates the target's supply voltage scale factor when applied to the ADC. A simple resistive divider can be used on the + * ADC pin for measuring the target's supply voltage, so that voltages above the programmer AVR's AVCC reference voltage can be + * measured. This should be the reciprocal of the division performed - e.g. if the VTARGET voltage is halved, this should be set + * to 2. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td> + * </tr> + * <tr> * <td>LIBUSB_DRIVER_COMPAT</td> * <td>Makefile CDEFS</td> * <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c index de21f0ff2d68fc79453a67d2eac4a5af3fd18f33..bc3ed18e09f7ee369dbd9850ece74dbd918939f8 100644 --- a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c +++ b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c @@ -98,7 +98,7 @@ void V2Params_UpdateParamValues(void) { #if (defined(ADC) && !defined(NO_VTARGET_DETECT)) /* Update VTARGET parameter with the latest ADC conversion of VTARGET on supported AVR models */ - V2Params_SetParameterValue(PARAM_VTARGET, ((5 * 10 * ADC_GetResult()) / 1024)); + V2Params_GetParamFromTable(PARAM_VTARGET)->ParamValue = (((uint16_t)(VTARGET_REF_VOLTS * 10 * VTARGET_SCALE_FACTOR) * ADC_GetResult()) / 1024); #endif } diff --git a/Projects/AVRISP-MKII/makefile b/Projects/AVRISP-MKII/makefile index 9cba8730a84b27a1501fe4e141628f02c48faa29..c6b64dfe130f866265bde17e1a7a79713f7638b6 100644 --- a/Projects/AVRISP-MKII/makefile +++ b/Projects/AVRISP-MKII/makefile @@ -197,6 +197,8 @@ CDEFS += -DAUX_LINE_MASK="(1 << 4)" CDEFS += -DVTARGET_ADC_CHANNEL=2 CDEFS += -DENABLE_ISP_PROTOCOL CDEFS += -DENABLE_XPROG_PROTOCOL +CDEFS += -DVTARGET_REF_VOLTS=5 +CDEFS += -DVTARGET_SCALE_FACTOR=1 #CDEFS += -DNO_VTARGET_DETECT #CDEFS += -DLIBUSB_DRIVER_COMPAT diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c index 79e1ddb32ee6595ab3bb8d3161dd52eca290aa82..4f3583e689567947d060e3c7fec1acabba0ed7db 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.c +++ b/Projects/XPLAINBridge/XPLAINBridge.c @@ -86,9 +86,14 @@ int main(void) for (;;) { if (CurrentFirmwareMode == MODE_USART_BRIDGE) - USARTBridge_Task(); + { + USARTBridge_Task(); + } else - AVRISP_Task(); + { + AVRISP_Task(); + V2Params_UpdateParamValues(); + } USB_USBTask(); } @@ -147,7 +152,6 @@ void SetupHardware(void) USB_Init(); V2Protocol_Init(); - #if 0 /* Disable JTAG debugging */ MCUCR |= (1 << JTD); MCUCR |= (1 << JTD); @@ -162,9 +166,6 @@ void SetupHardware(void) /* Re-enable JTAG debugging */ MCUCR &= ~(1 << JTD); MCUCR &= ~(1 << JTD); - #endif - - CurrentFirmwareMode = MODE_USART_BRIDGE; } /** Event handler for the library USB Configuration Changed event. */ diff --git a/Projects/XPLAINBridge/XPLAINBridge.txt b/Projects/XPLAINBridge/XPLAINBridge.txt index 3f9ab8ed37cbddbcb4271c5ce6c3b593cd91d95f..f22feca8e3879c96b5d099e9fd691aa55597eddc 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.txt +++ b/Projects/XPLAINBridge/XPLAINBridge.txt @@ -74,9 +74,9 @@ * <td><b>Description:</b></td> * </tr> * <tr> - * <td>BUFF_STATICSIZE</td> - * <td>RingBuff.h</td> - * <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer.</td> + * <td>BUFFER_SIZE</td> + * <td>LightweightRingBuff.h</td> + * <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer when in serial bridge mode.</td> * </tr> * <tr> * <td>LIBUSB_DRIVER_COMPAT</td> diff --git a/Projects/XPLAINBridge/makefile b/Projects/XPLAINBridge/makefile index c68c91da1412c35166f563e03170467df35e87f6..1aefdcad4b5ed69bc6bb8d7411a46e41aaa22458 100644 --- a/Projects/XPLAINBridge/makefile +++ b/Projects/XPLAINBridge/makefile @@ -201,6 +201,8 @@ CDEFS += -DAUX_LINE_PIN=PINB CDEFS += -DAUX_LINE_DDR=DDRB CDEFS += -DAUX_LINE_MASK="(1 << 4)" CDEFS += -DVTARGET_ADC_CHANNEL=2 +CDEFS += -DVTARGET_REF_VOLTS=3.3 +CDEFS += -DVTARGET_SCALE_FACTOR=2 #CDEFS += -DLIBUSB_DRIVER_COMPAT