Second patch to fix incorrect PDI/TPI programming speed.
This commit is contained in:
		
							parent
							
								
									d41cd9a41a
								
							
						
					
					
						commit
						f2324fc2b4
					
				
					 6 changed files with 8 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -66,7 +66,7 @@ void ISPProtocol_EnterISPMode(void)
 | 
			
		|||
 | 
			
		||||
	/* Perform execution delay, initialize SPI bus */
 | 
			
		||||
	ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);
 | 
			
		||||
	ISPTarget_Init();
 | 
			
		||||
	ISPTarget_EnableTargetISP();
 | 
			
		||||
 | 
			
		||||
	/* Continuously attempt to synchronize with the target until either the number of attempts specified
 | 
			
		||||
	 * by the host has exceeded, or the the device sends back the expected response values */
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +118,7 @@ void ISPProtocol_LeaveISPMode(void)
 | 
			
		|||
	/* Perform pre-exit delay, release the target /RESET, disable the SPI bus and perform the post-exit delay */
 | 
			
		||||
	ISPProtocol_DelayMS(Leave_ISP_Params.PreDelayMS);
 | 
			
		||||
	ISPTarget_ChangeTargetResetLine(false);
 | 
			
		||||
	ISPTarget_ShutDown();
 | 
			
		||||
	ISPTarget_DisableTargetISP();
 | 
			
		||||
	ISPProtocol_DelayMS(Leave_ISP_Params.PostDelayMS);
 | 
			
		||||
 | 
			
		||||
	Endpoint_Write_Byte(CMD_LEAVE_PROGMODE_ISP);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -142,7 +142,7 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
 | 
			
		|||
/** Initialises the appropriate SPI driver (hardware or software, depending on the selected ISP speed) ready for
 | 
			
		||||
 *  communication with the attached target.
 | 
			
		||||
 */
 | 
			
		||||
void ISPTarget_Init(void)
 | 
			
		||||
void ISPTarget_EnableTargetISP(void)
 | 
			
		||||
{
 | 
			
		||||
	uint8_t SCKDuration = V2Params_GetParameterValue(PARAM_SCK_DURATION);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -167,7 +167,7 @@ void ISPTarget_Init(void)
 | 
			
		|||
/** Shuts down the current selected SPI driver (hardware or software, depending on the selected ISP speed) so that no
 | 
			
		||||
 *  further communications can occur until the driver is re-initialized.
 | 
			
		||||
 */
 | 
			
		||||
void ISPTarget_ShutDown(void)
 | 
			
		||||
void ISPTarget_DisableTargetISP(void)
 | 
			
		||||
{
 | 
			
		||||
	if (HardwareSPIMode)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,8 +69,8 @@
 | 
			
		|||
		extern bool HardwareSPIMode;
 | 
			
		||||
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		void    ISPTarget_Init(void);
 | 
			
		||||
		void    ISPTarget_ShutDown(void);
 | 
			
		||||
		void    ISPTarget_EnableTargetISP(void);
 | 
			
		||||
		void    ISPTarget_DisableTargetISP(void);
 | 
			
		||||
		void    ISPTarget_ConfigureRescueClock(void);
 | 
			
		||||
		void    ISPTarget_ConfigureSoftwareISP(const uint8_t SCKDuration);
 | 
			
		||||
		uint8_t ISPTarget_TransferSoftSPIByte(const uint8_t Byte);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -113,7 +113,6 @@
 | 
			
		|||
		extern uint16_t XPROG_Param_EEPageSize;
 | 
			
		||||
		extern uint8_t  XPROG_Param_NVMCSRRegAddr;
 | 
			
		||||
		extern uint8_t  XPROG_Param_NVMCMDRegAddr;
 | 
			
		||||
		extern uint8_t  XPROG_SelectedProtocol;
 | 
			
		||||
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		void XPROGProtocol_SetMode(void);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ void XPROGTarget_EnableTargetPDI(void)
 | 
			
		|||
	_delay_us(1);
 | 
			
		||||
 | 
			
		||||
	/* Set up the synchronous USART for XMEGA communications - 8 data bits, even parity, 2 stop bits */
 | 
			
		||||
	UBRR1  = (F_CPU / XPROG_HARDWARE_SPEED);
 | 
			
		||||
	UBRR1  = ((F_CPU / 2 / XPROG_HARDWARE_SPEED) - 1);
 | 
			
		||||
	UCSR1B = (1 << TXEN1);
 | 
			
		||||
	UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue