diff --git a/MyConfig.mc3 b/MyConfig.mc3 index 509f0d155fde0203510a01fb6a9486289b581b98..b766c79c4bcab9ad6438ce79d6f3a24f58746433 100644 --- a/MyConfig.mc3 +++ b/MyConfig.mc3 @@ -16,14 +16,14 @@ <string>SPI1</string> <string>class com.microchip.mcc.mcu16.modules.spi_upb.SPI</string> </entry> - <entry> - <string>WATCHDOG</string> - <string>class com.microchip.mcc.mcu16.systemManager.wdt.Wdt</string> - </entry> <entry> <string>Pin Module</string> <string>class com.microchip.mcc.mcu16.pinManager.PinManager</string> </entry> + <entry> + <string>WATCHDOG</string> + <string>class com.microchip.mcc.mcu16.systemManager.wdt.Wdt</string> + </entry> <entry> <string>RESET</string> <string>class com.microchip.mcc.mcu16.systemManager.reset.RESET</string> @@ -44,16 +44,20 @@ <string>System Module</string> <string>class com.microchip.mcc.mcu16.systemManager.DefaultSystemManagerMcu16</string> </entry> + <entry> + <string>CMP3</string> + <string>class com.microchip.mcc.mcu16.modules.cmp.CMP</string> + </entry> <entry> <string>JTAG</string> <string>class com.microchip.mcc.mcu16.systemManager.jtag.JTAG</string> </entry> <entry> - <string>CMP3</string> + <string>CMP2</string> <string>class com.microchip.mcc.mcu16.modules.cmp.CMP</string> </entry> <entry> - <string>CMP2</string> + <string>CMP1</string> <string>class com.microchip.mcc.mcu16.modules.cmp.CMP</string> </entry> <entry> @@ -61,17 +65,13 @@ <string>class com.microchip.mcc.mcu16.systemManager.clk.Clock</string> </entry> <entry> - <string>CMP1</string> - <string>class com.microchip.mcc.mcu16.modules.cmp.CMP</string> + <string>IC1</string> + <string>class com.microchip.mcc.mcu16.modules.ic.IC</string> </entry> <entry> <string>I2C1</string> <string>class com.microchip.mcc.mcu16.modules.i2c.I2C</string> </entry> - <entry> - <string>IC1</string> - <string>class com.microchip.mcc.mcu16.modules.ic.IC</string> - </entry> <entry> <string>IC3</string> <string>class com.microchip.mcc.mcu16.modules.ic.IC</string> @@ -84,14 +84,14 @@ <string>TMR3</string> <string>class com.microchip.mcc.mcu16.modules.tmr.TMR</string> </entry> - <entry> - <string>CVR</string> - <string>class com.microchip.mcc.mcu16.modules.cvref.CVREF</string> - </entry> <entry> <string>com.microchip.mcc.mcu16.Mcu16PeripheralLibraryLibraryModule</string> <string>class com.microchip.mcc.protocolServices.base.modules.librarymodule.LibraryModule</string> </entry> + <entry> + <string>CVR</string> + <string>class com.microchip.mcc.mcu16.modules.cvref.CVREF</string> + </entry> </usedClasses> <usedLibraries class="java.util.ArrayList"> <ILibraryFile class="com.microchip.mcc.core.library.BaseLibraryFile" libraryClass="com.microchip.mcc.mcu16.Mcu16PeripheralLibrary" version="1.167.0"/> @@ -185,6 +185,10 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCPDA" settingAlias="IOCPDA1" alias="enabled"/> <value>1</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON1" settingAlias="ICSIDL" alias="disabled"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI2" registerAlias="SPIIMSKL" settingAlias="SRMTEN"/> <value>disabled</value> @@ -193,10 +197,6 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPICON1L" settingAlias="MODE16" alias="enabled"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON1" settingAlias="ICSIDL" alias="disabled"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCPDA" settingAlias="IOCPDA3" alias="disabled"/> <value>0</value> @@ -205,14 +205,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPIIMSKL" settingAlias="SRMTEN"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="BOEN" alias="disabled"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPIIMSKL" settingAlias="SRMTEN"/> <value>disabled</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="BOEN" alias="disabled"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="SCIE" alias="enabled"/> <value>1</value> @@ -901,14 +901,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CMP1" registerAlias="CMI" settingAlias="enable"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="I2C1" name="SDA"/> - <value>enabled</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CMP2" registerAlias="CMI" settingAlias="context"/> <value>OFF</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="I2C1" name="SDA"/> + <value>enabled</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CMP1" registerAlias="CMI" settingAlias="context"/> <value>OFF</value> @@ -985,14 +985,14 @@ <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="ioc RB0"/> <value>none</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1L" settingAlias="MCLKEN" alias="FOSC/2"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL"/> <value>TMR3</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1L" settingAlias="MCLKEN" alias="FOSC/2"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCPA" settingAlias="IOCPA0" alias="disabled"/> <value>0</value> @@ -1117,14 +1117,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="INTERNAL OSCILLATOR" registerAlias="OSCFDIV" settingAlias="TRIM"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="SDAHT" alias="enabled"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI1" registerAlias="SPIIMSKL" settingAlias="SPITUREN" alias="disabled"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="SDAHT" alias="enabled"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="MICI" settingAlias="priority"/> <value>1</value> @@ -1149,14 +1149,14 @@ <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="RPINR12"/> <value>16191</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CMP3" registerAlias="CMI" settingAlias="priority"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON1" settingAlias="ICI" alias="Every"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CMP3" registerAlias="CMI" settingAlias="priority"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="System Module" registerAlias="FOSCSEL" settingAlias="IESO" alias="ON"/> <value>128</value> @@ -1434,11 +1434,11 @@ <value>disabled</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="GCSTAT"/> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPITXI" settingAlias="flag"/> <value>disabled</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPITXI" settingAlias="flag"/> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="GCSTAT"/> <value>disabled</value> </entry> <entry> @@ -1473,14 +1473,14 @@ <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="INTERNAL OSCILLATOR" name="Pll_Dependent_Clock_Switching"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI1" registerAlias="SPIIMSKH" settingAlias="TXWIEN" alias="disabled"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="TMR3" registerAlias="TCON"/> <value>32784</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI1" registerAlias="SPIIMSKH" settingAlias="TXWIEN" alias="disabled"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPITXI" settingAlias="flag"/> <value>disabled</value> @@ -1757,14 +1757,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="D_nA"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1H" settingAlias="AUDMOD" alias="I2S"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR3" registerAlias="TCON" settingAlias="TCS" alias="External"/> <value>1</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1H" settingAlias="AUDMOD" alias="I2S"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="IOCPUA" settingAlias="IOCPUA3"/> <value>disabled</value> @@ -2389,14 +2389,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPICON1H" settingAlias="IGNTUR" alias="disabled"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPICON1L" settingAlias="MSTEN" alias="Slave"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="TMR3" name="TimerFrequency"/> <value>4000000</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPICON1L" settingAlias="MSTEN" alias="Slave"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="INTERNAL OSCILLATOR" registerAlias="OSCFDIV"/> <value>0</value> @@ -2529,14 +2529,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI2" registerAlias="SPICON1L" settingAlias="CKE"/> <value>Idle to Active</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPISTATL" settingAlias="SPITBF"/> - <value>disabled</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP1" registerAlias="CMCON" settingAlias="CPOL" alias="Not Inverted"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPISTATL" settingAlias="SPITBF"/> + <value>disabled</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="Pin Module" registerAlias="ANSB"/> <value>53764</value> @@ -2573,14 +2573,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="RPINR19" settingAlias="U2CTSR"/> <value>63</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CVR" registerAlias="CVRCON" settingAlias="CVREFM"/> - <value>Band gap voltage</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="TMR3" name="customPR"/> <value>65535</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CVR" registerAlias="CVRCON" settingAlias="CVREFM"/> + <value>Band gap voltage</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC1" registerAlias="ICCON1" settingAlias="ICM" alias="Off"/> <value>0</value> @@ -2685,14 +2685,14 @@ <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="INTERNAL OSCILLATOR" registerAlias="PMD6"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="I2CSIDL" alias="disabled"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC2" registerAlias="ICCON1" settingAlias="ICM"/> <value>Simple Capture mode: Falling</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="I2CSIDL" alias="disabled"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="CMP1" name="Dependent Module"/> <value>CVR</value> @@ -2845,6 +2845,10 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPIIMSKL" settingAlias="SPITUREN" alias="disabled"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="SDA%aux4"/> + <value>ALTI2CDIS</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCNA" settingAlias="IOCNA3" alias="enabled"/> <value>1</value> @@ -3009,14 +3013,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI2" registerAlias="SPICON1H" settingAlias="URDTEN"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="AHEN"/> - <value>disabled</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP1" registerAlias="CMCON" settingAlias="CREF" alias="CVREF"/> <value>1</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="AHEN"/> + <value>disabled</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="ioc AVSS"/> <value>none</value> @@ -3197,14 +3201,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="LATB" settingAlias="LATB6" alias="clear"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CVR" registerAlias="CVRCON" settingAlias="CVREN" alias="Powered Off"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON1" settingAlias="ICM" alias="Prescaler Capture mode: Every 16th rising"/> <value>5</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CVR" registerAlias="CVRCON" settingAlias="CVREN" alias="Powered Off"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC1" registerAlias="ICCON1" settingAlias="ICBNE"/> <value>disabled</value> @@ -3394,11 +3398,11 @@ <value>1</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP3" registerAlias="CMSTAT" settingAlias="C2OUT" alias="enabled"/> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR3" registerAlias="TCON" settingAlias="TON" alias="enabled"/> <value>1</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR3" registerAlias="TCON" settingAlias="TON" alias="enabled"/> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP3" registerAlias="CMSTAT" settingAlias="C2OUT" alias="enabled"/> <value>1</value> </entry> <entry> @@ -3461,14 +3465,14 @@ <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name VSS2"/> <value/> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPISTATL" settingAlias="SPIROV" alias="enabled"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC2" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="CMP1"/> <value>24</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPISTATL" settingAlias="SPIROV" alias="enabled"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="ODCB" settingAlias="ODCB14" alias="enabled"/> <value>1</value> @@ -3597,24 +3601,24 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1L" settingAlias="CKE" alias="Idle to Active"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPICON1H" settingAlias="IGNROV" alias="disabled"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC3" registerAlias="ICCON1" settingAlias="ICI"/> <value>Every</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPICON1H" settingAlias="IGNROV" alias="disabled"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCPB" settingAlias="IOCPB9" alias="disabled"/> <value>0</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="RBF"/> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPISTATL" settingAlias="SPIROV"/> <value>disabled</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPISTATL" settingAlias="SPIROV"/> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="RBF"/> <value>disabled</value> </entry> <entry> @@ -3633,14 +3637,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="INTERNAL OSCILLATOR" registerAlias="PMD1" settingAlias="SPI2MD" alias="disabled"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="DISSLW" alias="disabled"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPISTATL" settingAlias="SPIROV"/> <value>disabled</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="DISSLW" alias="disabled"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCPB" settingAlias="IOCPB12" alias="disabled"/> <value>0</value> @@ -3677,6 +3681,10 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="LATB" settingAlias="LATB10" alias="set"/> <value>1</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC3" registerAlias="ICI_INT" settingAlias="enable"/> + <value>disabled</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI2" registerAlias="SPICON1H" settingAlias="SPISGNEXT"/> <value>not sign-extended</value> @@ -3685,10 +3693,6 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPIIMSKL" settingAlias="SPIRBEN" alias="enabled"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC3" registerAlias="ICI_INT" settingAlias="enable"/> - <value>disabled</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPICON1H" settingAlias="SPISGNEXT"/> <value>not sign-extended</value> @@ -4097,6 +4101,10 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPISTATL" settingAlias="SPIROV" alias="enabled"/> <value>1</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="SCL%aux5"/> + <value>ALTI2CDIS</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPISTATL" settingAlias="SPITUR" alias="enabled"/> <value>1</value> @@ -4341,14 +4349,14 @@ <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="iocUserSet VCAP1"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1H" settingAlias="IGNTUR" alias="enabled"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="MCCP3 Sync\Trigger"/> <value>6</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1H" settingAlias="IGNTUR" alias="enabled"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="IOCPB" settingAlias="IOCPB3"/> <value>disabled</value> @@ -4713,6 +4721,10 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="OC1"/> <value>1</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="OC2"/> + <value>2</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP2" registerAlias="CMCON" settingAlias="CCH" alias="Internal selectable reference voltage"/> <value>3</value> @@ -4721,10 +4733,6 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPICON1L" settingAlias="DISSCK" alias="enabled"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="OC2"/> - <value>2</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCPDA" settingAlias="IOCPDA4" alias="enabled"/> <value>1</value> @@ -5889,14 +5897,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="INTERNAL OSCILLATOR" registerAlias="PMD1" settingAlias="T2MD" alias="disabled"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="SPI2" name="SPI2_SPITXIISRFunction"/> - <value>ISR_SPI2_SPITXI</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON1" settingAlias="ICI" alias="Every 4th event"/> <value>3</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="SPI2" name="SPI2_SPITXIISRFunction"/> + <value>ISR_SPI2_SPITXI</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="RESET" registerAlias="RCON" settingAlias="BOR"/> <value>disabled</value> @@ -5961,6 +5969,10 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="DHEN"/> <value>disabled</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPII" settingAlias="priority"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="I2CEN"/> <value>enabled</value> @@ -5969,10 +5981,6 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="P" alias="enabled"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPII" settingAlias="priority"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPII" settingAlias="priority"/> <value>1</value> @@ -6185,14 +6193,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPIIMSKL" settingAlias="SPIROVEN" alias="enabled"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="SEN" alias="disabled"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI1" registerAlias="SPISTATL" settingAlias="SPIRBF" alias="enabled"/> <value>1</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="SEN" alias="disabled"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="IOCFA" settingAlias="IOCFA4"/> <value>disabled</value> @@ -6785,14 +6793,14 @@ <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="CMP2" registerAlias="CMSTAT"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI1" registerAlias="SPIIMSKL" settingAlias="BUSYEN" alias="enabled"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="CMP1" registerAlias="CMSTAT"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI1" registerAlias="SPIIMSKL" settingAlias="BUSYEN" alias="enabled"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="CMP3" registerAlias="CMSTAT"/> <value>0</value> @@ -7254,11 +7262,11 @@ <value>0</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="RSEN" alias="disabled"/> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP2" registerAlias="CMSTAT" settingAlias="C2OUT" alias="disabled"/> <value>0</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP2" registerAlias="CMSTAT" settingAlias="C2OUT" alias="disabled"/> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="RSEN" alias="disabled"/> <value>0</value> </entry> <entry> @@ -7423,7 +7431,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="STREN"/> - <value>disabled</value> + <value>enabled</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="RPINR19" settingAlias="U2RXR"/> @@ -7577,14 +7585,14 @@ <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="ioc RB10"/> <value>none</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="ACKEN" alias="enabled"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPICON1L" settingAlias="ENHBUF"/> <value>enabled</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="ACKEN" alias="enabled"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPICON1L" settingAlias="ENHBUF"/> <value>enabled</value> @@ -7633,22 +7641,22 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CMP3" registerAlias="CMCON" settingAlias="COUT"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="AHEN" alias="enabled"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CMP2" registerAlias="CMCON" settingAlias="COUT"/> <value>disabled</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPICON1H" settingAlias="FRMPOL"/> - <value>disabled</value> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="AHEN" alias="enabled"/> + <value>1</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="IC3" name="Trigger Source Mode"/> <value/> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPICON1H" settingAlias="FRMPOL"/> + <value>disabled</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="Pin Module" registerAlias="IOCPA" settingAlias="IOCPA2"/> <value>disabled</value> @@ -7789,14 +7797,14 @@ <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="INTERNAL OSCILLATOR" registerAlias="CLKDIV"/> <value>12288</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1L" settingAlias="MCLKEN" alias="MCLK"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="TMR3" name="prescaleDivisor"/> <value>8</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1L" settingAlias="MCLKEN" alias="MCLK"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI1" registerAlias="SPIIMSKL" settingAlias="SPIRBFEN" alias="enabled"/> <value>1</value> @@ -7873,14 +7881,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="INTERNAL OSCILLATOR" registerAlias="PMD3" settingAlias="CRCMD" alias="disabled"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPICON1H" settingAlias="URDTEN" alias="enabled"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR3" registerAlias="TCON" settingAlias="TECS" alias="TMRCK"/> <value>3</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI3" registerAlias="SPICON1H" settingAlias="URDTEN" alias="enabled"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="ANSB" settingAlias="ANSELB15" alias="digital"/> <value>0</value> @@ -8121,26 +8129,26 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="System Module" registerAlias="FOSC" settingAlias="POSCMOD" alias="EC"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPITXI" settingAlias="context"/> - <value>OFF</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="TMR1"/> <value>11</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="System Module" registerAlias="FWDT" settingAlias="WDTPS" alias="PS128"/> - <value>7</value> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPITXI" settingAlias="context"/> + <value>OFF</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI2" registerAlias="SPITXI" settingAlias="context"/> - <value>OFF</value> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="System Module" registerAlias="FWDT" settingAlias="WDTPS" alias="PS128"/> + <value>7</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="TMR2"/> <value>12</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI2" registerAlias="SPITXI" settingAlias="context"/> + <value>OFF</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCPUB" settingAlias="IOCPUB10" alias="enabled"/> <value>1</value> @@ -8149,14 +8157,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="INTERNAL OSCILLATOR" registerAlias="PMD1" settingAlias="U1MD" alias="enabled"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPITXI" settingAlias="context"/> - <value>OFF</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="TMR3"/> <value>13</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPITXI" settingAlias="context"/> + <value>OFF</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="SPI1" registerAlias="SPIURDTH"/> <value>0</value> @@ -8349,14 +8357,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="ANSA" settingAlias="ANSELA3" alias="analog"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="ACKSTAT" alias="disabled"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC2" registerAlias="ICI_INT" settingAlias="priority"/> <value>1</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="ACKSTAT" alias="disabled"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC1" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="ADC1"/> <value>27</value> @@ -8657,14 +8665,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="RESET" registerAlias="RCON" settingAlias="RETEN"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="FLASH" registerAlias="NVMKEY"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="TMR3" registerAlias="PR" settingAlias="PR"/> <value>65535</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="FLASH" registerAlias="NVMKEY"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="FLASH" registerAlias="NVMCON" settingAlias="WR" alias="Initiates a Flash memory program or erase operation"/> <value>1</value> @@ -8838,11 +8846,11 @@ <value>1</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="ACKTIM"/> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPISTATL" settingAlias="SRMT"/> <value>disabled</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPISTATL" settingAlias="SRMT"/> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="ACKTIM"/> <value>disabled</value> </entry> <entry> @@ -8929,14 +8937,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI2" registerAlias="SPICON1L" settingAlias="MSTEN"/> <value>Master</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="SICI" settingAlias="context"/> - <value>OFF</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPICON1L" settingAlias="MSTEN"/> <value>Master</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="SICI" settingAlias="context"/> + <value>OFF</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="INTERNAL OSCILLATOR" registerAlias="PMD5" settingAlias="CCP5MD" alias="enabled"/> <value>0</value> @@ -8981,14 +8989,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC2" registerAlias="ICI_INT" settingAlias="context"/> <value>OFF</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1H" settingAlias="FRMEN" alias="disabled"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC3" registerAlias="ICI_INT" settingAlias="context"/> <value>OFF</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1H" settingAlias="FRMEN" alias="disabled"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="CVR" registerAlias="CVRCON" settingAlias="CVR"/> <value>8</value> @@ -8997,14 +9005,14 @@ <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="SPI3" name="SPI3_SPIRXIISRFunction"/> <value>ISR_SPI3_SPIRXI</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC2" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="MCCP4 Capture\Compare"/> - <value>22</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="IC3"/> <value>18</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC2" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="MCCP4 Capture\Compare"/> + <value>22</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCPUB" settingAlias="IOCPUB14" alias="disabled"/> <value>0</value> @@ -9637,14 +9645,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCONH" settingAlias="SDAHT"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="SMEN"/> - <value>enabled</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR3" registerAlias="TCON" settingAlias="TSIDL" alias="enabled"/> <value>1</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="SMEN"/> + <value>enabled</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="TRISB" settingAlias="TRISB2" alias="input"/> <value>1</value> @@ -9751,7 +9759,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="I2C1" registerAlias="I2CCON"/> - <value>33536</value> + <value>33600</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPICON1L" settingAlias="SSEN"/> @@ -10173,6 +10181,10 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="IC1" registerAlias="ICCON2" settingAlias="IC32"/> <value>disabled</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="MCCP4 Capture\Compare"/> + <value>22</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="FLASH" name="FLASH_NVMIISRFunction"/> <value>ISR_FLASH_NVMI</value> @@ -10181,10 +10193,6 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI1" registerAlias="SPIIMSKL" settingAlias="SPIROVEN" alias="disabled"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="IC3" registerAlias="ICCON2" settingAlias="SYNCSEL" alias="MCCP4 Capture\Compare"/> - <value>22</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="TRISB" settingAlias="TRISB0" alias="output"/> <value>0</value> @@ -10249,14 +10257,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="IOCNB" settingAlias="IOCNB15" alias="enabled"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="SPI1" name="SPIFunctionMode"/> - <value>SPI</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP1" registerAlias="CMCON" settingAlias="COUT" alias="disabled"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="SPI1" name="SPIFunctionMode"/> + <value>SPI</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="TRISA" settingAlias="TRISA3" alias="output"/> <value>0</value> @@ -10277,14 +10285,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="ANSB" settingAlias="ANSELB2" alias="digital"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP3" registerAlias="CMCON" settingAlias="EVPOL" alias="Disabled"/> - <value>0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR3" registerAlias="TCON" settingAlias="TCKPS" alias="1:64"/> <value>2</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CMP3" registerAlias="CMCON" settingAlias="EVPOL" alias="Disabled"/> + <value>0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="System Module" registerAlias="FWDT" settingAlias="FWPSA" alias="PR128"/> <value>16</value> @@ -10365,14 +10373,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI2" registerAlias="SPICON1L" settingAlias="DISSDO"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="BCL" alias="enabled"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI1" registerAlias="SPICON1H" settingAlias="AUDMOD" alias="I2S"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="I2C1" registerAlias="I2CSTAT" settingAlias="BCL" alias="enabled"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI3" registerAlias="SPICON1L" settingAlias="DISSDO"/> <value>disabled</value> @@ -10513,14 +10521,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="SPI2" registerAlias="SPICON1L" settingAlias="MSTEN" alias="Master"/> <value>1</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="I2CSIDL"/> - <value>disabled</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="SPI1" registerAlias="SPICON2L" settingAlias="WLENGTH"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="I2C1" registerAlias="I2CCON" settingAlias="I2CSIDL"/> + <value>disabled</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="RB10"/> <value>disabled</value> @@ -10589,7 +10597,7 @@ </entry> <entry> <file>mcc_generated_files/system.c</file> - <hash>921c8064bef54265750802ba3bc29ff5b0dbd54f07cd2a9410e2d565437f3b6f</hash> + <hash>cc7272dfa38aecf7284f64722920e78c6fc0e87f5a5016e7e0b8b56b91cefc1b</hash> </entry> <entry> <file>mcc_generated_files/cvr.c</file> @@ -10649,7 +10657,7 @@ </entry> <entry> <file>mcc_generated_files/mcc.h</file> - <hash>0a1c130e082e8d2107cf1490c13082db12a98926c7cba78fe6db9a18e1507908</hash> + <hash>4d65300e02d81a7b0b842edd2d54fc1444ae256a0026bd7c624218234a768980</hash> </entry> <entry> <file>mcc_generated_files/cmp3.c</file> @@ -10669,7 +10677,7 @@ </entry> <entry> <file>mcc_generated_files/pin_manager.c</file> - <hash>1175331b2625f6b8123e5bba886b1e5a8437bd9944e2a6f82a664f05ecc00191</hash> + <hash>60c6cab5fd937a691400aeb265ab0ed863e93830bec21421a84e108030ff90e9</hash> </entry> <entry> <file>mcc_generated_files/cmp3.h</file> @@ -10717,7 +10725,7 @@ </entry> <entry> <file>mcc_generated_files/i2c1.c</file> - <hash>ad8a05bc5024add6ef408c27847f107f323f0306cce89014da91b9d53407ec30</hash> + <hash>69f0e5cadf74dd1ffe7bc05bcbfbb5a497d88bf7ce9fc171c33894dc9c494ac8</hash> </entry> </generatedFileHashHistoryMap> <mc3libFileHashHistoryMap class="java.util.HashMap"/> diff --git a/copy.sh b/copy.sh new file mode 100644 index 0000000000000000000000000000000000000000..ebbd49414fb48cceccfb1bfec0102513f2ebebb9 --- /dev/null +++ b/copy.sh @@ -0,0 +1,2 @@ +scp dist/default/production/rcu2hbat.production.hex pi@ppkpi4:picprog/. +ssh pi@ppkpi4 "cd picprog;sh prog.sh" diff --git a/main.c b/main.c index 9178b1438fce53a2354d809384202b394f952931..d9cdaa58ca83750fe96631892555609d4e8b0e44 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,7 @@ */ void LED_on() {_LATA0=1;}; void LED_off() {_LATA0=0;}; -I2C_SLAVE_STATES I2Cstate; +//I2C_SLAVE_STATES I2Cstate; bool I2CbusyTX=false; uint16_t HBA1_IC_previous,HBA2_IC_previous,HBA3_IC_previous; uint16_t cnt=0; //Sleep on overflow @@ -45,15 +45,15 @@ HBA_STATES HBA2_state; HBA_STATES HBA3_state; void Handle_I2C(void){ - I2Cstate=SI2C1Interrupt(); - switch (I2Cstate){ - case I2C_EVENT_TX_REQUEST: - I2C_Send(I2C_TX_request()); - break; - case I2C_EVENT_RX: - I2C_packet(); - break; - } +// I2Cstate=SI2C1Interrupt(); +// switch (I2Cstate){ +// case I2C_EVENT_TX_REQUEST: +// I2C_Send(I2C_TX_request()); +// break; +// case I2C_EVENT_RX: +// I2C_packet(); +// break; +// } } void GoToSleep(){ @@ -67,10 +67,15 @@ void GoToSleep(){ SPI3CON1Lbits.DISSDO=1; //SPI2CON1Lbits.SPIEN=0; // SPI3CON1Lbits.SPIEN=0; - IEC1bits.SI2C1IE = 1; //Enable global interrupt so that we wake up on I2C +// IEC1bits.SI2C1IE = 1; //Enable global interrupt so that we wake up on I2C + +// I2C1CONLbits.SCLREL = 1; +// IFS1bits.SI2C1IF = 0; +// I2C1_Initialize(); + I2C1_reset(); Sleep(); HBA1_state=HBA_STATE_IDLE; - IEC1bits.SI2C1IE = 0; +// IEC1bits.SI2C1IE = 0; // IC1CON1 = 0x02; //Input capture on // IC2CON1 = 0x02; // IC3CON1 = 0x02; @@ -133,17 +138,22 @@ int main(void) { if ((++cnt==0) && (HBA1_state==HBA_STATE_IDLE)) GoToSleep(); //go to sleep //cnt reset each time a characters is TX or RX, or I2C interrupt //Handle I2C - if (I2C_interrupt) {Handle_I2C();cnt=0;} - if ((I2Cstate==S_SLAVE_RECEIVE_MODE) && (I2C1STATbits.P==1)) { - I2C_packet(); - I2Cstate=S_SLAVE_IDLE; - } +// if (I2C_busy()) cnt=0; + I2C_busy(); +// if (I2C_interrupt) {Handle_I2C();cnt=0;} +// if ((I2Cstate==S_SLAVE_RECEIVE_MODE) && (I2C1STATbits.P==1)) { +// I2C_packet(); +// I2Cstate=S_SLAVE_IDLE; +// } HBA1_mainloop(); HBA2_mainloop(); HBA3_mainloop(); } return 1; } + + + /** End of File */ diff --git a/mcc_generated_files/cvr.c b/mcc_generated_files/cvr.c index 83df9ea89622ebe8f39f21d07f3a3a368e28f2a4..53a9c688bc302b8f3ed86d04669b739657b59934 100644 --- a/mcc_generated_files/cvr.c +++ b/mcc_generated_files/cvr.c @@ -56,7 +56,8 @@ void CVR_Initialize(void) { // CVREN Powered On; CVREFP CVR; CVRSS AVDD ? AVSS; CVREFM Band gap voltage; CVROE disabled; CVR 8; - CVRCON = 0x8C; +// CVRCON = 0x8C; + CVRCON = 0x88; // VBGEN2 disabled; ANCFG |= 0x00; } diff --git a/mcc_generated_files/i2c1.c b/mcc_generated_files/i2c1.c index 53a7818eecfdd7f2eadea795b615b5a3abd81e41..509e1435c24f177be482b49ec312637701a92eaa 100644 --- a/mcc_generated_files/i2c1.c +++ b/mcc_generated_files/i2c1.c @@ -14,12 +14,12 @@ @Description This header file provides APIs for driver for i2c1. Generation Information : - Product Revision : PIC24 / dsPIC33 / PIC32MM MCUs - 1.166.1 - Device : PIC24FJ128GA204 + Product Revision : PIC24 / dsPIC33 / PIC32MM MCUs - 1.167.0 + Device : PIC24FJ64GA702 The generated drivers are tested against the following: - Compiler : XC16 v1.41 - MPLAB : MPLAB X v5.30 + Compiler : XC16 v1.50 + MPLAB : MPLAB X v5.35 */ /* @@ -45,7 +45,8 @@ */ #include "i2c1.h" -//#include "mcc_generated_files/pin_manager.h" +#include "../src/rcu2_i2c.h" + /** Section: Data Types */ @@ -60,7 +61,14 @@ This defines the different states that the i2c slave used to process transactions on the i2c bus. */ +typedef enum +{ + S_SLAVE_IDLE, + S_SLAVE_RECEIVE_MODE, + S_SLAVE_TRANSMIT_MODE, + S_SLAVE_LOW_BYTE_ADDRESS_DETECT, +} I2C_SLAVE_STATES; /** Section: Macro Definitions @@ -77,7 +85,6 @@ #define I2C1_GENERAL_CALL_ENABLE_BIT I2C1CONLbits.GCEN // I2C General Call enable control bit. #define I2C1_10_BIT_ADDRESS_ENABLE_BIT I2C1CONLbits.A10M // I2C Address Mode (7 or 10 bit address) control bit. #define I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT I2C1CONLbits.SCLREL // I2C clock stretch/release control bit. -#define I2C1_ENABLE I2C1CONLbits.I2CEN // I2C General Call enable control bit. // The following status bits are used in the I2C state machine to determine // the next states. @@ -87,9 +94,8 @@ #define I2C1_RECEIVE_OVERFLOW_STATUS_BIT I2C1STATbits.I2COV // I2C receive buffer overflow status bit. #define I2C1_GENERAL_CALL_ADDRESS_STATUS_BIT I2C1STATbits.GCSTAT // I2C General Call status bit. #define I2C1_ACKNOWLEDGE_STATUS_BIT I2C1STATbits.ACKSTAT // I2C ACK status bit. -#define I2C1_STOP_STATUS_BIT I2C1STATbits.P //Stop bit -#define EMULATE_EEPROM_SIZE 64 +//#define EMULATE_EEPROM_SIZE 64 /** Section: Local Functions */ @@ -100,13 +106,6 @@ inline void __attribute__ ((always_inline)) I2C1_ReceiveProcess(void); /** Section: Local Variables */ -uint8_t I2C_length; -uint8_t I2C_address; -uint8_t I2C_data[64]; - -inline uint8_t* I2C_Buffer(void) {return I2C_data;} -inline uint8_t I2C_Buffer_Length(void) {return I2C_length;} -inline uint8_t I2C_Address(void) {return I2C_address;} static I2C_SLAVE_STATES i2c1_slave_state; //static uint8_t *p_i2c1_write_pointer; @@ -125,14 +124,13 @@ void I2C1_Initialize(void) { // initialize the hardware - // ACKEN disabled; STRICT disabled; STREN disabled; GCEN disabled; SMEN enabled; DISSLW disabled; I2CSIDL disabled; ACKDT Sends ACK; SCLREL Holds; RSEN disabled; A10M 7 Bit; PEN disabled; RCEN disabled; SEN disabled; I2CEN enabled; - I2C1CONL = 0x8300; -// I2C1CONL = 0x8000; + // ACKEN disabled; STRICT disabled; STREN enabled; GCEN disabled; SMEN enabled; DISSLW disabled; I2CSIDL disabled; ACKDT Sends ACK; SCLREL Holds; RSEN disabled; A10M 7 Bit; PEN disabled; RCEN disabled; SEN disabled; I2CEN enabled; + I2C1CONL = 0x8340; // BCL disabled; D_nA disabled; R_nW disabled; P disabled; S disabled; I2COV disabled; IWCOL disabled; I2C1STAT = 0x00; - // ADD 32; + // ADD 64; I2C1_SlaveAddressSet(0x40); - // MSK 7; + // MSK 3; I2C1_SlaveAddressMaskSet(0x03); // make sure this is set first @@ -145,90 +143,91 @@ void I2C1_Initialize(void) // clear the master interrupt flag IFS1bits.SI2C1IF = 0; // enable the master interrupt - //IEC1bits.SI2C1IE = 1; + IEC1bits.SI2C1IE = 1; } +void I2C1_reset(void){ + //IFS1bits.SI2C1IF = 0; + // enable the master interrupt + //IEC1bits.SI2C1IE = 1; + I2C1CONL = 0x0340; + I2C1CONL = 0x8340; + i2c1_slave_state = S_SLAVE_IDLE; +// I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; + //dummy = I2C1_RECEIVE_REG; -uint8_t I2C_tx_cnt; - -void I2C_Send(uint8_t len){ - I2C_length=len; - I2C1_TRANSMIT_REG = I2C_data[I2C_tx_cnt++]; - if (I2C_tx_cnt>=I2C_length) I2C_tx_cnt=0; - I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; } void __attribute__ ( ( interrupt, no_auto_psv ) ) _SI2C1Interrupt ( void ) -{ -//_LATA0=1; -IEC1bits.SI2C1IE = 0; -IFS1bits.SI2C1IF = 1; -} -I2C_SLAVE_STATES SI2C1Interrupt ( void ) { - //static bool prior_address_match = false; - //static bool not_busy = true; +// static bool prior_address_match = false; +// static bool not_busy = true; uint8_t dummy; // NOTE: The slave driver will always acknowledge // any address match. - IFS1bits.SI2C1IF = 0; switch (i2c1_slave_state) { case S_SLAVE_IDLE: case S_SLAVE_RECEIVE_MODE: - if (I2C1_DATA_NOT_ADDRESS_STATUS_BIT == 0) { - if (I2C1_READ_NOT_WRITE_STATUS_BIT == 0) //Write or Read + if (I2C1_DATA_NOT_ADDRESS_STATUS_BIT == 0) + { + + if (I2C1_READ_NOT_WRITE_STATUS_BIT == 0) { - - I2C_length=0; - I2C_address=I2C1_RECEIVE_REG>>1; + // it is a write, go to receive mode + dummy = I2C1_RECEIVE_REG; + I2C_start_RX(dummy); i2c1_slave_state = S_SLAVE_RECEIVE_MODE; } else { - I2C_address = I2C1_RECEIVE_REG>>1; + // it is a read, go to transmit mode + dummy = I2C1_RECEIVE_REG; + I2C1_TRANSMIT_REG=I2C_start_TX(dummy); + I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; i2c1_slave_state = S_SLAVE_TRANSMIT_MODE; - I2C_tx_cnt=0; - IFS1bits.SI2C1IF = 1; - return I2C_EVENT_TX_REQUEST; //Main program must follow with TX } } - //if (i2c1_slave_state == S_SLAVE_RECEIVE_MODE) { - if (I2C1_DATA_NOT_ADDRESS_STATUS_BIT == 1) + if (i2c1_slave_state == S_SLAVE_RECEIVE_MODE) + { + // case of data received + if (I2C1_DATA_NOT_ADDRESS_STATUS_BIT == 1) { // check if we are overflowing the receive buffer if (I2C1_RECEIVE_OVERFLOW_STATUS_BIT != 1) { - I2C_data[I2C_length++]=I2C1_RECEIVE_REG; + dummy = I2C1_RECEIVE_REG; + //I2C1_ReceiveProcess(); + //not_busy = I2C1_StatusCallback(I2C1_SLAVE_RECEIVED_DATA_DETECTED); + I2C_RX_byte(dummy); } else { - // overflow detected! - I2C_data[I2C_length++]=I2C1_RECEIVE_REG; + dummy = I2C1_RECEIVE_REG; I2C1_RECEIVE_OVERFLOW_STATUS_BIT = 0; } } - if (I2C1_STOP_STATUS_BIT==1) { - i2c1_slave_state = S_SLAVE_IDLE; - return I2C_EVENT_RX; - } - //} + } + break; + + case S_SLAVE_LOW_BYTE_ADDRESS_DETECT: + break; + case S_SLAVE_TRANSMIT_MODE: + + // if the transaction was ACK'ed, more data needs to be sent + // if the transaction was NACK'ed then we don't need to send + // more data if (I2C1_ACKNOWLEDGE_STATUS_BIT == 0) { // prepare next data - //I2C1_StatusCallback(I2C1_SLAVE_TRANSMIT_REQUEST_DETECTED); - - // transmit more data - I2C1_TRANSMIT_REG = I2C_data[I2C_tx_cnt++]; - if (I2C_tx_cnt>=I2C_length) I2C_tx_cnt=0; - // set the SCL clock to be released + I2C1_TRANSMIT_REG=I2C_TX_byte(); I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; } @@ -236,6 +235,7 @@ I2C_SLAVE_STATES SI2C1Interrupt ( void ) { // no more data to be sent so we go to idle state i2c1_slave_state = S_SLAVE_IDLE; + I2C_done_TX(); } break; @@ -243,38 +243,17 @@ I2C_SLAVE_STATES SI2C1Interrupt ( void ) default: // should never happen, if we ever get here stay here forever while(1); - i2c1_slave_state = S_SLAVE_IDLE; - I2C1_ENABLE=0; - I2C1_ENABLE=1; break; } I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; // clear the slave interrupt flag - return i2c1_slave_state; -} -/* -void I2C1_ReadPointerSet(uint8_t *p) -{ - p_i2c1_read_pointer = p; -} + IFS1bits.SI2C1IF = 0; -void I2C1_WritePointerSet(uint8_t *p) -{ - p_i2c1_write_pointer = p; } -uint8_t *I2C1_ReadPointerGet(void) -{ - return (p_i2c1_read_pointer); -} -uint8_t *I2C1_WritePointerGet(void) -{ - return (p_i2c1_write_pointer); -} -*/ void I2C1_SlaveAddressMaskSet( uint16_t mask) { @@ -284,36 +263,33 @@ void I2C1_SlaveAddressMaskSet( void I2C1_SlaveAddressSet( uint16_t address) { - I2C1_10_BIT_ADDRESS_ENABLE_BIT = false; + if (address > 0x7F) + { + // use 10 bit address + I2C1_10_BIT_ADDRESS_ENABLE_BIT = true; + } + else + { + // use 7 bit address + I2C1_10_BIT_ADDRESS_ENABLE_BIT = false; + } i2c1_slave_state = S_SLAVE_IDLE; I2C1_ADDRESS_REG = address; + } -/* -inline void __attribute__ ((always_inline)) I2C1_TransmitProcess(void) -{ - // get the data to be transmitted - // sanity check (to avoid stress) - if (p_i2c1_read_pointer == NULL) - return; +/* Note: This is an example of the I2C1_StatusCallback() + implementation. This is an emulated EEPROM Memory + configured to act as a I2C Slave Device. + For specific slave device implementation, remove + or modify this function to the specific slave device + behavior. +*/ - I2C1_TRANSMIT_REG = *p_i2c1_read_pointer; +//static uint8_t i2c1_slaveWriteData = 0xAA; - // set the SCL clock to be released - I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; -} -inline void __attribute__ ((always_inline)) I2C1_ReceiveProcess(void) -{ - // store the received data - - // sanity check (to avoid stress) - if (p_i2c1_write_pointer == NULL) - return; - *p_i2c1_write_pointer = I2C1_RECEIVE_REG; -} -*/ diff --git a/mcc_generated_files/i2c1.c.poll b/mcc_generated_files/i2c1.c.poll new file mode 100644 index 0000000000000000000000000000000000000000..53a7818eecfdd7f2eadea795b615b5a3abd81e41 --- /dev/null +++ b/mcc_generated_files/i2c1.c.poll @@ -0,0 +1,319 @@ + +/** + I2C1 Generated Driver File + + @Company + Microchip Technology Inc. + + @File Name + i2c1.c + + @Summary + This is the generated header file for the i2c1 driver using PIC24 / dsPIC33 / PIC32MM MCUs + + @Description + This header file provides APIs for driver for i2c1. + Generation Information : + Product Revision : PIC24 / dsPIC33 / PIC32MM MCUs - 1.166.1 + Device : PIC24FJ128GA204 + + The generated drivers are tested against the following: + Compiler : XC16 v1.41 + MPLAB : MPLAB X v5.30 +*/ + +/* + (c) 2020 Microchip Technology Inc. and its subsidiaries. You may use this + software and any derivatives exclusively with Microchip products. + + THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER + EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A + PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION + WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. + + IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND + WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS + BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE + FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN + ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + + MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE + TERMS. +*/ + +#include "i2c1.h" +//#include "mcc_generated_files/pin_manager.h" +/** + Section: Data Types +*/ + +/** + I2C Slave Driver State Enumeration + + @Summary + Defines the different states of the i2c slave. + + @Description + This defines the different states that the i2c slave + used to process transactions on the i2c bus. +*/ + + +/** + Section: Macro Definitions +*/ +/* defined for I2C1 */ +#define I2C1_TRANSMIT_REG I2C1TRN // Defines the transmit register used to send data. +#define I2C1_RECEIVE_REG I2C1RCV // Defines the receive register used to receive data. + +#define I2C1_MASK_REG I2C1MSK // Defines the address mask register. +#define I2C1_ADDRESS_REG I2C1ADD // Defines the address register. + +// The following control bits are used in the I2C state machine to manage +// the I2C module and determine next states. +#define I2C1_GENERAL_CALL_ENABLE_BIT I2C1CONLbits.GCEN // I2C General Call enable control bit. +#define I2C1_10_BIT_ADDRESS_ENABLE_BIT I2C1CONLbits.A10M // I2C Address Mode (7 or 10 bit address) control bit. +#define I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT I2C1CONLbits.SCLREL // I2C clock stretch/release control bit. +#define I2C1_ENABLE I2C1CONLbits.I2CEN // I2C General Call enable control bit. + +// The following status bits are used in the I2C state machine to determine +// the next states. + +#define I2C1_READ_NOT_WRITE_STATUS_BIT I2C1STATbits.R_W // I2C current transaction read/write status bit. +#define I2C1_DATA_NOT_ADDRESS_STATUS_BIT I2C1STATbits.D_A // I2C last byte receive was data/address status bit. +#define I2C1_RECEIVE_OVERFLOW_STATUS_BIT I2C1STATbits.I2COV // I2C receive buffer overflow status bit. +#define I2C1_GENERAL_CALL_ADDRESS_STATUS_BIT I2C1STATbits.GCSTAT // I2C General Call status bit. +#define I2C1_ACKNOWLEDGE_STATUS_BIT I2C1STATbits.ACKSTAT // I2C ACK status bit. +#define I2C1_STOP_STATUS_BIT I2C1STATbits.P //Stop bit + +#define EMULATE_EEPROM_SIZE 64 +/** + Section: Local Functions +*/ + +inline void __attribute__ ((always_inline)) I2C1_TransmitProcess(void); +inline void __attribute__ ((always_inline)) I2C1_ReceiveProcess(void); + +/** + Section: Local Variables +*/ +uint8_t I2C_length; +uint8_t I2C_address; +uint8_t I2C_data[64]; + +inline uint8_t* I2C_Buffer(void) {return I2C_data;} +inline uint8_t I2C_Buffer_Length(void) {return I2C_length;} +inline uint8_t I2C_Address(void) {return I2C_address;} + +static I2C_SLAVE_STATES i2c1_slave_state; +//static uint8_t *p_i2c1_write_pointer; +//static uint8_t *p_i2c1_read_pointer; + +/** + Prototype: void I2C1_Initialize(void) + Input: none + Output: none + Description: I2C1_Initialize is an + initialization routine that takes inputs from the GUI. + Comment: + Usage: I2C1_Initialize(); +*/ +void I2C1_Initialize(void) +{ + + // initialize the hardware + // ACKEN disabled; STRICT disabled; STREN disabled; GCEN disabled; SMEN enabled; DISSLW disabled; I2CSIDL disabled; ACKDT Sends ACK; SCLREL Holds; RSEN disabled; A10M 7 Bit; PEN disabled; RCEN disabled; SEN disabled; I2CEN enabled; + I2C1CONL = 0x8300; +// I2C1CONL = 0x8000; + // BCL disabled; D_nA disabled; R_nW disabled; P disabled; S disabled; I2COV disabled; IWCOL disabled; + I2C1STAT = 0x00; + // ADD 32; + I2C1_SlaveAddressSet(0x40); + // MSK 7; + I2C1_SlaveAddressMaskSet(0x03); + + // make sure this is set first + i2c1_slave_state = S_SLAVE_IDLE; + +// I2C1_ReadPointerSet(NULL); +// I2C1_WritePointerSet(NULL); + + /* SI2C1 - I2C1 Slave Events */ + // clear the master interrupt flag + IFS1bits.SI2C1IF = 0; + // enable the master interrupt + //IEC1bits.SI2C1IE = 1; + +} + + +uint8_t I2C_tx_cnt; + +void I2C_Send(uint8_t len){ + I2C_length=len; + I2C1_TRANSMIT_REG = I2C_data[I2C_tx_cnt++]; + if (I2C_tx_cnt>=I2C_length) I2C_tx_cnt=0; + I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; +} + +void __attribute__ ( ( interrupt, no_auto_psv ) ) _SI2C1Interrupt ( void ) +{ +//_LATA0=1; +IEC1bits.SI2C1IE = 0; +IFS1bits.SI2C1IF = 1; +} +I2C_SLAVE_STATES SI2C1Interrupt ( void ) +{ + + //static bool prior_address_match = false; + //static bool not_busy = true; + uint8_t dummy; + + // NOTE: The slave driver will always acknowledge + // any address match. + IFS1bits.SI2C1IF = 0; + + switch (i2c1_slave_state) + { + case S_SLAVE_IDLE: + case S_SLAVE_RECEIVE_MODE: + if (I2C1_DATA_NOT_ADDRESS_STATUS_BIT == 0) { + if (I2C1_READ_NOT_WRITE_STATUS_BIT == 0) //Write or Read + { + + I2C_length=0; + I2C_address=I2C1_RECEIVE_REG>>1; + i2c1_slave_state = S_SLAVE_RECEIVE_MODE; + } + else + { + I2C_address = I2C1_RECEIVE_REG>>1; + i2c1_slave_state = S_SLAVE_TRANSMIT_MODE; + I2C_tx_cnt=0; + IFS1bits.SI2C1IF = 1; + return I2C_EVENT_TX_REQUEST; //Main program must follow with TX + } + + } + //if (i2c1_slave_state == S_SLAVE_RECEIVE_MODE) { + if (I2C1_DATA_NOT_ADDRESS_STATUS_BIT == 1) + { + // check if we are overflowing the receive buffer + if (I2C1_RECEIVE_OVERFLOW_STATUS_BIT != 1) + { + I2C_data[I2C_length++]=I2C1_RECEIVE_REG; + } + else + { + // overflow detected! + I2C_data[I2C_length++]=I2C1_RECEIVE_REG; + I2C1_RECEIVE_OVERFLOW_STATUS_BIT = 0; + } + } + if (I2C1_STOP_STATUS_BIT==1) { + i2c1_slave_state = S_SLAVE_IDLE; + return I2C_EVENT_RX; + } + //} + break; + case S_SLAVE_TRANSMIT_MODE: + if (I2C1_ACKNOWLEDGE_STATUS_BIT == 0) + { + // prepare next data + //I2C1_StatusCallback(I2C1_SLAVE_TRANSMIT_REQUEST_DETECTED); + + // transmit more data + I2C1_TRANSMIT_REG = I2C_data[I2C_tx_cnt++]; + if (I2C_tx_cnt>=I2C_length) I2C_tx_cnt=0; + // set the SCL clock to be released + I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; + + } + else //if (I2C1_ACKNOWLEDGE_STATUS_BIT == 1) + { + // no more data to be sent so we go to idle state + i2c1_slave_state = S_SLAVE_IDLE; + } + break; + + + default: + // should never happen, if we ever get here stay here forever + while(1); + i2c1_slave_state = S_SLAVE_IDLE; + I2C1_ENABLE=0; + I2C1_ENABLE=1; + break; + } + + I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; + + // clear the slave interrupt flag + return i2c1_slave_state; +} +/* +void I2C1_ReadPointerSet(uint8_t *p) +{ + p_i2c1_read_pointer = p; +} + +void I2C1_WritePointerSet(uint8_t *p) +{ + p_i2c1_write_pointer = p; +} + +uint8_t *I2C1_ReadPointerGet(void) +{ + return (p_i2c1_read_pointer); +} + +uint8_t *I2C1_WritePointerGet(void) +{ + return (p_i2c1_write_pointer); +} +*/ +void I2C1_SlaveAddressMaskSet( + uint16_t mask) +{ + I2C1_MASK_REG = mask; +} + +void I2C1_SlaveAddressSet( + uint16_t address) +{ + I2C1_10_BIT_ADDRESS_ENABLE_BIT = false; + i2c1_slave_state = S_SLAVE_IDLE; + I2C1_ADDRESS_REG = address; +} +/* +inline void __attribute__ ((always_inline)) I2C1_TransmitProcess(void) +{ + // get the data to be transmitted + + // sanity check (to avoid stress) + if (p_i2c1_read_pointer == NULL) + return; + + I2C1_TRANSMIT_REG = *p_i2c1_read_pointer; + + // set the SCL clock to be released + I2C1_RELEASE_SCL_CLOCK_CONTROL_BIT = 1; + +} + +inline void __attribute__ ((always_inline)) I2C1_ReceiveProcess(void) +{ + // store the received data + + // sanity check (to avoid stress) + if (p_i2c1_write_pointer == NULL) + return; + + *p_i2c1_write_pointer = I2C1_RECEIVE_REG; + +} + +*/ diff --git a/mcc_generated_files/i2c1.h b/mcc_generated_files/i2c1.h index 4c070d21a56d0cf7ac2dbfa920bd43d00d345ce8..30fe51459bcbb6eaca2c8642de87183530ee653b 100644 --- a/mcc_generated_files/i2c1.h +++ b/mcc_generated_files/i2c1.h @@ -14,12 +14,12 @@ @Description This header file provides APIs for driver for I2C1. Generation Information : - Product Revision : PIC24 / dsPIC33 / PIC32MM MCUs - 1.166.1 - Device : PIC24FJ128GA204 + Product Revision : PIC24 / dsPIC33 / PIC32MM MCUs - 1.167.0 + Device : PIC24FJ64GA702 The generated drivers are tested against the following: - Compiler : XC16 v1.41 - MPLAB : MPLAB X v5.30 + Compiler : XC16 v1.50 + MPLAB : MPLAB X v5.35 */ /* @@ -58,60 +58,340 @@ #endif +//uint8_t* I2C_Buffer(void); +//uint8_t I2C_Buffer_Length(void); +//uint8_t I2C_Address(void); +//void I2C_Send(uint8_t len) {}; + + + +/** + I2C Slave Driver Status + + @Summary + Defines the different status that the slave driver has + detected over the i2c bus. + + @Description + This defines the different status that the slave driver has + detected over the i2c bus. The status is passed to the + I2C1_StatusCallback() callback function that is implemented by + the user of the slave driver as a parameter to inform the user + that there was a change in the status of the driver due to + transactions on the i2c bus. User of the slave driver can use these + to manage the read or write buffers. + + */ + typedef enum { - S_SLAVE_IDLE, - S_SLAVE_RECEIVE_MODE, - S_SLAVE_TRANSMIT_MODE, - S_SLAVE_LOW_BYTE_ADDRESS_DETECT, - I2C_EVENT_TX_REQUEST, - I2C_EVENT_RX + /* This state indicates that the slave driver has detected a transmit request from the master. + The next transaction will be a read transaction. Application should prime the transmit + buffer with the valid data to be sent to the master using the: I2C1_ReadPointerSet() + + */ + I2C1_SLAVE_TRANSMIT_REQUEST_DETECTED, + + /* This state indicates that the slave driver has detected a reception request from the master. + The next transaction will be a write transaction. Application should set up the receive + buffer by setting the location of the receive buffer using the: I2C1_WritePointerSet() + */ + I2C1_SLAVE_RECEIVE_REQUEST_DETECTED, + + /* This state indicates that the slave driver has received data from the master. + Application can use this status to process the received data set up the receive + buffer in anticipation of next reception in case the master sends more data. + See I2C1_SLAVE_RECEIVE_REQUEST_DETECTED. + */ + I2C1_SLAVE_RECEIVED_DATA_DETECTED, + + /* This state indicates that the slave driver has detected the most significant + byte of the 10-bit slave address. Another transaction with the least + significant byte of the 10-bit address with a read/write request will + be detected next. This second detection is automatically done by the + driver which may return one of the following: + a. I2C1_SLAVE_RECEIVE_REQUEST_DETECTED + b. I2C1_SLAVE_TRANSMIT_REQUEST_DETECTED + c. I2C1_SLAVE_10BIT_RECEIVE_REQUEST_DETECTED + a or b is detected depending on the read/write bit of the received + control data. If c is detected next, the master decided to resend + the most significant address. + */ + I2C1_SLAVE_10BIT_RECEIVE_REQUEST_DETECTED, + +} I2C1_SLAVE_DRIVER_STATUS; -} I2C_SLAVE_STATES; +#define I2C1_SLAVE_DEFAULT_ADDRESS 99 -#define I2C_interrupt IFS1bits.SI2C1IF +/** + @Summary + Initializes and enables the i2c slave instance : 1 + + @Description + This routine initializes the i2c slave driver instance for : 1 + index, making it ready for clients to open and use it. + + @Preconditions + None + + @Param + None + + @Returns + None + + @Example + <code> + + uint8_t SlaveReadBuffer; + uint8_t SlaveWriteBuffer; + + // initialize the i2c slave driver + I2C1_Initialize(); + + // set up the slave driver + + // initialize the location of the read buffer + I2C1_ReadPointerSet(SlaveReadBuffer); + // initialize the location of the write buffer + I2C1_WritePointerSet(SlaveWriteBuffer); + + </code> +*/ +void I2C1_Initialize(void); -#define I2C1_SLAVE_DEFAULT_ADDRESS 99 +/** + @Summary + This function sets the slave address mask. -uint8_t* I2C_Buffer(void); -uint8_t I2C_Buffer_Length(void); -uint8_t I2C_Address(void); + @Description + This function sets the 10-bit slave address mask to be able to + respond to multiple addresses. This function should be called + after the initialization of the module. + @Preconditions + None + + @Param + mask - The address mask to be used when filtering + addresses from the i2c master transactions. + + @Returns + None + + @Example + <code> + Refer to I2C1_SlaveAddressSet() for an example + </code> + +*/ -void I2C1_Initialize(void); -void I2C_Send(uint8_t len); void I2C1_SlaveAddressMaskSet( uint16_t mask); +/** + @Summary + This function sets the slave address. + + @Description + This function sets the 10-bit slave address to be used by the + module when filtering transactions from the i2c masters in the + bus. The function analyzes the given address and decides if + the 10-bit or 7-bit mode will be enabled. Once the function + returns, the given address is set for the slave module. + + This function should be called after the initialization of + the module. + + When changing the slave address the module must be idle. + + @Preconditions + None + + @Param + address - The address to be used to determine if the transaction + is intended for this slave module. + + @Returns + None + + @Example + <code> + // initialize the i2c slave driver + I2C1_Initialize(); + + // set the slave address and address mask if the default + // values set in the initialize is not the desired values. + I2C1_SlaveAddressMaskSet(0x0xF); + I2C1_SlaveAddressSet(0x3C); + + </code> +*/ void I2C1_SlaveAddressSet( uint16_t address); -/* +/** + @Summary + This function sets the read pointer for the slave driver. -void I2C1_ReadPointerSet(uint8_t *p); + @Description + This function sets the read pointer that the driver will + need to retrieve data that will be transmitted to the master + whenever the master requests a read. + @Preconditions + None + @Param + *p - The pointer to the read buffer, that will be used to transmit + data to the requesting i2c master. -void I2C1_WritePointerSet(uint8_t *p); + @Returns + None + @Example + <code> + Refer to I2C1_Initialize() for an example + </code> +*/ -uint8_t *I2C1_ReadPointerGet(void); +/** + @Summary + This application implemented function passes the + status of the i2c slave driver. + + @Description + This application implemented function passes the + status of the i2c slave driver. The status passed + can be used by the application to manage the read and + write buffers. This function is called by the slave + driver everytime there is an event in the i2c bus that caused + an interrupt in the i2c slave module to be asserted. + + The function will return boolean. The value of the return + will determine if the next received byte will be ack'ed or + nack'ed. By doing that, the application can have the + ability to delay incoming transactions. When a false is + returned, the next transactions will be nack'ed forcing the + master to restart the transactions. + + Returning a false will give the application a chance to + prepare for the next transactions (for example: a read + requests from the master) or process the recently received + data. + + @Preconditions + None + + @Param + status - The latest status of the slave driver due + to an event in the i2c bus. + + @Returns + True, if the application is ready for the next transaction. + False, if the application is not ready for the next transaction. + + @Example + <code> + + // Example implementation of the callback + + static uint8_t i2c1_slaveWriteData = 0xAA; + + bool I2C1_StatusCallback(I2C1_SLAVE_DRIVER_STATUS status) + { + + // this emulates the slave device memory where data written to slave + // is placed and data read from slave is taken + static uint8_t EMULATE_EEPROM_Memory[64] = + { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + }; + + static uint16_t address, addrByteCount; + static bool addressState = true; + + switch (status) + { + case I2C1_SLAVE_TRANSMIT_REQUEST_DETECTED: + + // set up the slave driver buffer transmit pointer + I2C1_ReadPointerSet(&EMULATE_EEPROM_Memory[address]); + address++; + + break; + + case I2C1_SLAVE_RECEIVE_REQUEST_DETECTED: + + addrByteCount = 0; + addressState = true; + + // set up the slave driver buffer receive pointer + I2C1_WritePointerSet(&i2c1_slaveWriteData); + + break; + + case I2C1_SLAVE_RECEIVED_DATA_DETECTED: + + if (addressState == true) + { + // get the address of the memory being written + if (addrByteCount == 0) + { + address = (i2c1_slaveWriteData << 8) & 0xFF00; + addrByteCount++; + } + else if (addrByteCount == 1) + { + address = address | i2c1_slaveWriteData; + addrByteCount = 0; + addressState = false; + } + } + else // if (addressState == false) + { + // set the memory with the received data + EMULATE_EEPROM_Memory[address] = i2c1_slaveWriteData; + } + + break; + + case I2C1_SLAVE_10BIT_RECEIVE_REQUEST_DETECTED: + + // do something here when 10-bit address is detected + // 10-bit address is detected + + break; + default: + break; -uint8_t *I2C1_WritePointerGet(void); -*/ + } + return true; + } + + </code> -I2C_SLAVE_STATES SI2C1Interrupt ( void ); + */ +//#pragma message "I2C1_StatusCallback() is an Application implemented function. If this function is already implemented, you can turn off this message by deleting or commenting out this message." //bool I2C1_StatusCallback(I2C1_SLAVE_DRIVER_STATUS status); +void I2C1_reset(void); #ifdef __cplusplus // Provide C++ Compatibility diff --git a/mcc_generated_files/i2c1.h.poll b/mcc_generated_files/i2c1.h.poll new file mode 100644 index 0000000000000000000000000000000000000000..4c070d21a56d0cf7ac2dbfa920bd43d00d345ce8 --- /dev/null +++ b/mcc_generated_files/i2c1.h.poll @@ -0,0 +1,122 @@ + +/** + I2C1 Generated Driver API Header File + + @Company + Microchip Technology Inc. + + @File Name + i2c1.h + + @Summary + This is the generated header file for the I2C1 driver using PIC24 / dsPIC33 / PIC32MM MCUs + + @Description + This header file provides APIs for driver for I2C1. + Generation Information : + Product Revision : PIC24 / dsPIC33 / PIC32MM MCUs - 1.166.1 + Device : PIC24FJ128GA204 + + The generated drivers are tested against the following: + Compiler : XC16 v1.41 + MPLAB : MPLAB X v5.30 +*/ + +/* + (c) 2020 Microchip Technology Inc. and its subsidiaries. You may use this + software and any derivatives exclusively with Microchip products. + + THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER + EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A + PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION + WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. + + IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND + WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS + BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE + FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN + ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, + THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. + + MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE + TERMS. +*/ + +#ifndef _I2C1_H +#define _I2C1_H + +#include <stdint.h> +#include <stdbool.h> +#include <stddef.h> +#include <xc.h> + +#ifdef __cplusplus // Provide C++ Compatibility + + extern "C" { + +#endif + +typedef enum +{ + S_SLAVE_IDLE, + S_SLAVE_RECEIVE_MODE, + S_SLAVE_TRANSMIT_MODE, + S_SLAVE_LOW_BYTE_ADDRESS_DETECT, + I2C_EVENT_TX_REQUEST, + I2C_EVENT_RX + +} I2C_SLAVE_STATES; + +#define I2C_interrupt IFS1bits.SI2C1IF + + + +#define I2C1_SLAVE_DEFAULT_ADDRESS 99 + +uint8_t* I2C_Buffer(void); +uint8_t I2C_Buffer_Length(void); +uint8_t I2C_Address(void); + + +void I2C1_Initialize(void); +void I2C_Send(uint8_t len); +void I2C1_SlaveAddressMaskSet( + uint16_t mask); + + + +void I2C1_SlaveAddressSet( + uint16_t address); + + +/* + +void I2C1_ReadPointerSet(uint8_t *p); + + + +void I2C1_WritePointerSet(uint8_t *p); + + + +uint8_t *I2C1_ReadPointerGet(void); + + + +uint8_t *I2C1_WritePointerGet(void); +*/ + + +I2C_SLAVE_STATES SI2C1Interrupt ( void ); + +//bool I2C1_StatusCallback(I2C1_SLAVE_DRIVER_STATUS status); + +#ifdef __cplusplus // Provide C++ Compatibility + + } + +#endif + +#endif // _I2C1_H \ No newline at end of file diff --git a/mcc_generated_files/mcc.h b/mcc_generated_files/mcc.h index 9f606547eff2eac7251a8cc2a72f12622ea50ff5..70e7ef49cf54c5eed24ba7fe6f744199346959e3 100644 --- a/mcc_generated_files/mcc.h +++ b/mcc_generated_files/mcc.h @@ -51,20 +51,20 @@ #include <stdint.h> #include <stdbool.h> -#include "i2c1.h" -#include "ic3.h" -#include "ic2.h" -#include "ic1.h" -#include "memory/flash.h" -#include "cmp3.h" #include "cmp2.h" +#include "cmp3.h" +#include "ic2.h" +#include "ic3.h" #include "cmp1.h" -#include "cvr.h" +#include "ic1.h" #include "interrupt_manager.h" #include "traps.h" -#include "spi3.h" -#include "spi2.h" +#include "memory/flash.h" #include "spi1.h" +#include "cvr.h" +#include "spi2.h" +#include "spi3.h" +#include "i2c1.h" #include "tmr3.h" #warning "This file will be removed in future MCC releases. Use system.h instead." diff --git a/mcc_generated_files/pin_manager.c b/mcc_generated_files/pin_manager.c index a6b1742ae88fb53e7be466f46856341e4cab11ae..83f03c633032e152fa7c0cddab1470129b6964a2 100644 --- a/mcc_generated_files/pin_manager.c +++ b/mcc_generated_files/pin_manager.c @@ -95,14 +95,14 @@ void PIN_MANAGER_Initialize (void) ***************************************************************************/ __builtin_write_OSCCONL(OSCCON & 0xbf); // unlock PPS - RPOR6bits.RP12R = 0x001A; //RB12->CMP3:C3OUT RPINR7bits.IC1R = 0x0003; //RB3->IC1:IC1 - RPOR1bits.RP2R = 0x0001; //RB2->CMP1:C1OUT - RPOR5bits.RP10R = 0x000A; //RB10->SPI2:SDO2 RPOR7bits.RP15R = 0x0017; //RB15->SPI3:SDO3 + RPOR1bits.RP2R = 0x0001; //RB2->CMP1:C1OUT + RPOR3bits.RP7R = 0x0002; //RB7->CMP2:C2OUT RPOR13bits.RP27R = 0x0007; //RA1->SPI1:SDO1 + RPOR6bits.RP12R = 0x001A; //RB12->CMP3:C3OUT + RPOR5bits.RP10R = 0x000A; //RB10->SPI2:SDO2 RPINR7bits.IC2R = 0x0008; //RB8->IC2:IC2 - RPOR3bits.RP7R = 0x0002; //RB7->CMP2:C2OUT RPINR8bits.IC3R = 0x000D; //RB13->IC3:IC3 __builtin_write_OSCCONL(OSCCON | 0x40); // lock PPS diff --git a/mcc_generated_files/system.c b/mcc_generated_files/system.c index b854acc487d82ebff35252ce4214f0c18073babc..030df77ec5399ab3755c2c290b5d69d4faf6e09e 100644 --- a/mcc_generated_files/system.c +++ b/mcc_generated_files/system.c @@ -97,20 +97,20 @@ #include "pin_manager.h" #include "clock.h" #include "system.h" -#include "i2c1.h" -#include "ic3.h" -#include "ic2.h" -#include "ic1.h" -#include "memory/flash.h" -#include "cmp3.h" #include "cmp2.h" +#include "cmp3.h" +#include "ic2.h" +#include "ic3.h" #include "cmp1.h" -#include "cvr.h" +#include "ic1.h" #include "interrupt_manager.h" #include "traps.h" -#include "spi3.h" -#include "spi2.h" +#include "memory/flash.h" #include "spi1.h" +#include "cvr.h" +#include "spi2.h" +#include "spi3.h" +#include "i2c1.h" #include "tmr3.h" void SYSTEM_Initialize(void) diff --git a/nbproject/Makefile-default.mk b/nbproject/Makefile-default.mk index eac83fa1ed6409acae534281fac3b098d2323f2d..4766e850bc6c746008a69c60ac5bb30c990a587a 100644 --- a/nbproject/Makefile-default.mk +++ b/nbproject/Makefile-default.mk @@ -99,217 +99,217 @@ ${OBJECTDIR}/mcc_generated_files/spi3.o: mcc_generated_files/spi3.c nbproject/M @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/spi3.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/spi3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi3.c -o ${OBJECTDIR}/mcc_generated_files/spi3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi3.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi3.c -o ${OBJECTDIR}/mcc_generated_files/spi3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi3.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/spi3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/spi1.o: mcc_generated_files/spi1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/spi1.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/spi1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi1.c -o ${OBJECTDIR}/mcc_generated_files/spi1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi1.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi1.c -o ${OBJECTDIR}/mcc_generated_files/spi1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi1.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/spi1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/spi2.o: mcc_generated_files/spi2.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/spi2.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/spi2.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi2.c -o ${OBJECTDIR}/mcc_generated_files/spi2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi2.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi2.c -o ${OBJECTDIR}/mcc_generated_files/spi2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi2.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/spi2.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/system.o: mcc_generated_files/system.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/system.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/system.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/system.c -o ${OBJECTDIR}/mcc_generated_files/system.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/system.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/system.c -o ${OBJECTDIR}/mcc_generated_files/system.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/system.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/system.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/cvr.o: mcc_generated_files/cvr.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/cvr.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/cvr.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cvr.c -o ${OBJECTDIR}/mcc_generated_files/cvr.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cvr.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cvr.c -o ${OBJECTDIR}/mcc_generated_files/cvr.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cvr.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/cvr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/ic3.o: mcc_generated_files/ic3.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/ic3.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/ic3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic3.c -o ${OBJECTDIR}/mcc_generated_files/ic3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic3.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic3.c -o ${OBJECTDIR}/mcc_generated_files/ic3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic3.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/ic3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/clock.o: mcc_generated_files/clock.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/clock.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/clock.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/clock.c -o ${OBJECTDIR}/mcc_generated_files/clock.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/clock.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/clock.c -o ${OBJECTDIR}/mcc_generated_files/clock.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/clock.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/clock.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/ic2.o: mcc_generated_files/ic2.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/ic2.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/ic2.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic2.c -o ${OBJECTDIR}/mcc_generated_files/ic2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic2.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic2.c -o ${OBJECTDIR}/mcc_generated_files/ic2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic2.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/ic2.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/ic1.o: mcc_generated_files/ic1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/ic1.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/ic1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic1.c -o ${OBJECTDIR}/mcc_generated_files/ic1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic1.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic1.c -o ${OBJECTDIR}/mcc_generated_files/ic1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic1.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/ic1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/cmp2.o: mcc_generated_files/cmp2.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/cmp2.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/cmp2.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp2.c -o ${OBJECTDIR}/mcc_generated_files/cmp2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp2.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp2.c -o ${OBJECTDIR}/mcc_generated_files/cmp2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp2.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/cmp2.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/cmp1.o: mcc_generated_files/cmp1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/cmp1.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/cmp1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp1.c -o ${OBJECTDIR}/mcc_generated_files/cmp1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp1.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp1.c -o ${OBJECTDIR}/mcc_generated_files/cmp1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp1.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/cmp1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/cmp3.o: mcc_generated_files/cmp3.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/cmp3.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/cmp3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp3.c -o ${OBJECTDIR}/mcc_generated_files/cmp3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp3.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp3.c -o ${OBJECTDIR}/mcc_generated_files/cmp3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp3.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/cmp3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o: mcc_generated_files/interrupt_manager.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/interrupt_manager.c -o ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/interrupt_manager.c -o ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/mcc.o: mcc_generated_files/mcc.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/mcc.c -o ${OBJECTDIR}/mcc_generated_files/mcc.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/mcc.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/mcc.c -o ${OBJECTDIR}/mcc_generated_files/mcc.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/mcc.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/mcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/pin_manager.o: mcc_generated_files/pin_manager.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/pin_manager.c -o ${OBJECTDIR}/mcc_generated_files/pin_manager.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/pin_manager.c -o ${OBJECTDIR}/mcc_generated_files/pin_manager.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/tmr3.o: mcc_generated_files/tmr3.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/tmr3.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/tmr3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/tmr3.c -o ${OBJECTDIR}/mcc_generated_files/tmr3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/tmr3.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/tmr3.c -o ${OBJECTDIR}/mcc_generated_files/tmr3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/tmr3.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/tmr3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/traps.o: mcc_generated_files/traps.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/traps.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/traps.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/traps.c -o ${OBJECTDIR}/mcc_generated_files/traps.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/traps.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/traps.c -o ${OBJECTDIR}/mcc_generated_files/traps.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/traps.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/traps.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/i2c1.o: mcc_generated_files/i2c1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/i2c1.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/i2c1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/i2c1.c -o ${OBJECTDIR}/mcc_generated_files/i2c1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/i2c1.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/i2c1.c -o ${OBJECTDIR}/mcc_generated_files/i2c1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/i2c1.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/i2c1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/registers.o: src/registers.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/registers.o.d @${RM} ${OBJECTDIR}/src/registers.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/registers.c -o ${OBJECTDIR}/src/registers.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/registers.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/registers.c -o ${OBJECTDIR}/src/registers.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/registers.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/registers.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/rcu2_i2c.o: src/rcu2_i2c.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/rcu2_i2c.o.d @${RM} ${OBJECTDIR}/src/rcu2_i2c.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/rcu2_i2c.c -o ${OBJECTDIR}/src/rcu2_i2c.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/rcu2_i2c.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/rcu2_i2c.c -o ${OBJECTDIR}/src/rcu2_i2c.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/rcu2_i2c.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/rcu2_i2c.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/crc16.o: src/crc16.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/crc16.o.d @${RM} ${OBJECTDIR}/src/crc16.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/crc16.c -o ${OBJECTDIR}/src/crc16.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/crc16.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/crc16.c -o ${OBJECTDIR}/src/crc16.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/crc16.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/crc16.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA1.o: src/HBA1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA1.o.d @${RM} ${OBJECTDIR}/src/HBA1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1.c -o ${OBJECTDIR}/src/HBA1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1.c -o ${OBJECTDIR}/src/HBA1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA2.o: src/HBA2.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA2.o.d @${RM} ${OBJECTDIR}/src/HBA2.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2.c -o ${OBJECTDIR}/src/HBA2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2.c -o ${OBJECTDIR}/src/HBA2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA2.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA2_RX.o: src/HBA2_RX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA2_RX.o.d @${RM} ${OBJECTDIR}/src/HBA2_RX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2_RX.c -o ${OBJECTDIR}/src/HBA2_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2_RX.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2_RX.c -o ${OBJECTDIR}/src/HBA2_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2_RX.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA2_RX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA2_TX.o: src/HBA2_TX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA2_TX.o.d @${RM} ${OBJECTDIR}/src/HBA2_TX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2_TX.c -o ${OBJECTDIR}/src/HBA2_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2_TX.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2_TX.c -o ${OBJECTDIR}/src/HBA2_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2_TX.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA2_TX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA3.o: src/HBA3.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA3.o.d @${RM} ${OBJECTDIR}/src/HBA3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3.c -o ${OBJECTDIR}/src/HBA3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3.c -o ${OBJECTDIR}/src/HBA3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA3_RX.o: src/HBA3_RX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA3_RX.o.d @${RM} ${OBJECTDIR}/src/HBA3_RX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3_RX.c -o ${OBJECTDIR}/src/HBA3_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3_RX.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3_RX.c -o ${OBJECTDIR}/src/HBA3_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3_RX.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA3_RX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA3_TX.o: src/HBA3_TX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA3_TX.o.d @${RM} ${OBJECTDIR}/src/HBA3_TX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3_TX.c -o ${OBJECTDIR}/src/HBA3_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3_TX.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3_TX.c -o ${OBJECTDIR}/src/HBA3_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3_TX.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA3_TX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA1_TX.o: src/HBA1_TX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA1_TX.o.d @${RM} ${OBJECTDIR}/src/HBA1_TX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1_TX.c -o ${OBJECTDIR}/src/HBA1_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1_TX.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1_TX.c -o ${OBJECTDIR}/src/HBA1_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1_TX.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA1_TX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA1_RX.o: src/HBA1_RX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA1_RX.o.d @${RM} ${OBJECTDIR}/src/HBA1_RX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1_RX.c -o ${OBJECTDIR}/src/HBA1_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1_RX.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1_RX.c -o ${OBJECTDIR}/src/HBA1_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1_RX.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA1_RX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/main.o: main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/main.o.d @${RM} ${OBJECTDIR}/main.o - ${MP_CC} $(MP_EXTRA_CC_PRE) main.c -o ${OBJECTDIR}/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) main.c -o ${OBJECTDIR}/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/main.o.d" -g -D__DEBUG -mno-eds-warn -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else @@ -317,217 +317,217 @@ ${OBJECTDIR}/mcc_generated_files/spi3.o: mcc_generated_files/spi3.c nbproject/M @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/spi3.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/spi3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi3.c -o ${OBJECTDIR}/mcc_generated_files/spi3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi3.c -o ${OBJECTDIR}/mcc_generated_files/spi3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/spi3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/spi1.o: mcc_generated_files/spi1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/spi1.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/spi1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi1.c -o ${OBJECTDIR}/mcc_generated_files/spi1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi1.c -o ${OBJECTDIR}/mcc_generated_files/spi1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/spi1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/spi2.o: mcc_generated_files/spi2.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/spi2.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/spi2.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi2.c -o ${OBJECTDIR}/mcc_generated_files/spi2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi2.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/spi2.c -o ${OBJECTDIR}/mcc_generated_files/spi2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/spi2.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/spi2.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/system.o: mcc_generated_files/system.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/system.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/system.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/system.c -o ${OBJECTDIR}/mcc_generated_files/system.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/system.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/system.c -o ${OBJECTDIR}/mcc_generated_files/system.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/system.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/system.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/cvr.o: mcc_generated_files/cvr.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/cvr.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/cvr.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cvr.c -o ${OBJECTDIR}/mcc_generated_files/cvr.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cvr.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cvr.c -o ${OBJECTDIR}/mcc_generated_files/cvr.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cvr.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/cvr.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/ic3.o: mcc_generated_files/ic3.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/ic3.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/ic3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic3.c -o ${OBJECTDIR}/mcc_generated_files/ic3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic3.c -o ${OBJECTDIR}/mcc_generated_files/ic3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/ic3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/clock.o: mcc_generated_files/clock.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/clock.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/clock.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/clock.c -o ${OBJECTDIR}/mcc_generated_files/clock.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/clock.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/clock.c -o ${OBJECTDIR}/mcc_generated_files/clock.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/clock.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/clock.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/ic2.o: mcc_generated_files/ic2.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/ic2.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/ic2.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic2.c -o ${OBJECTDIR}/mcc_generated_files/ic2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic2.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic2.c -o ${OBJECTDIR}/mcc_generated_files/ic2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic2.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/ic2.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/ic1.o: mcc_generated_files/ic1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/ic1.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/ic1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic1.c -o ${OBJECTDIR}/mcc_generated_files/ic1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/ic1.c -o ${OBJECTDIR}/mcc_generated_files/ic1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/ic1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/ic1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/cmp2.o: mcc_generated_files/cmp2.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/cmp2.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/cmp2.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp2.c -o ${OBJECTDIR}/mcc_generated_files/cmp2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp2.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp2.c -o ${OBJECTDIR}/mcc_generated_files/cmp2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp2.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/cmp2.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/cmp1.o: mcc_generated_files/cmp1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/cmp1.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/cmp1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp1.c -o ${OBJECTDIR}/mcc_generated_files/cmp1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp1.c -o ${OBJECTDIR}/mcc_generated_files/cmp1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/cmp1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/cmp3.o: mcc_generated_files/cmp3.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/cmp3.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/cmp3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp3.c -o ${OBJECTDIR}/mcc_generated_files/cmp3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/cmp3.c -o ${OBJECTDIR}/mcc_generated_files/cmp3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/cmp3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/cmp3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o: mcc_generated_files/interrupt_manager.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/interrupt_manager.c -o ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/interrupt_manager.c -o ${OBJECTDIR}/mcc_generated_files/interrupt_manager.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/interrupt_manager.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/mcc.o: mcc_generated_files/mcc.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/mcc.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/mcc.c -o ${OBJECTDIR}/mcc_generated_files/mcc.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/mcc.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/mcc.c -o ${OBJECTDIR}/mcc_generated_files/mcc.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/mcc.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/mcc.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/pin_manager.o: mcc_generated_files/pin_manager.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/pin_manager.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/pin_manager.c -o ${OBJECTDIR}/mcc_generated_files/pin_manager.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/pin_manager.c -o ${OBJECTDIR}/mcc_generated_files/pin_manager.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/pin_manager.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/tmr3.o: mcc_generated_files/tmr3.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/tmr3.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/tmr3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/tmr3.c -o ${OBJECTDIR}/mcc_generated_files/tmr3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/tmr3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/tmr3.c -o ${OBJECTDIR}/mcc_generated_files/tmr3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/tmr3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/tmr3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/traps.o: mcc_generated_files/traps.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/traps.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/traps.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/traps.c -o ${OBJECTDIR}/mcc_generated_files/traps.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/traps.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/traps.c -o ${OBJECTDIR}/mcc_generated_files/traps.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/traps.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/traps.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/mcc_generated_files/i2c1.o: mcc_generated_files/i2c1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/mcc_generated_files" @${RM} ${OBJECTDIR}/mcc_generated_files/i2c1.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/i2c1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/i2c1.c -o ${OBJECTDIR}/mcc_generated_files/i2c1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/i2c1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) mcc_generated_files/i2c1.c -o ${OBJECTDIR}/mcc_generated_files/i2c1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/mcc_generated_files/i2c1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/i2c1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/registers.o: src/registers.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/registers.o.d @${RM} ${OBJECTDIR}/src/registers.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/registers.c -o ${OBJECTDIR}/src/registers.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/registers.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/registers.c -o ${OBJECTDIR}/src/registers.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/registers.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/registers.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/rcu2_i2c.o: src/rcu2_i2c.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/rcu2_i2c.o.d @${RM} ${OBJECTDIR}/src/rcu2_i2c.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/rcu2_i2c.c -o ${OBJECTDIR}/src/rcu2_i2c.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/rcu2_i2c.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/rcu2_i2c.c -o ${OBJECTDIR}/src/rcu2_i2c.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/rcu2_i2c.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/rcu2_i2c.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/crc16.o: src/crc16.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/crc16.o.d @${RM} ${OBJECTDIR}/src/crc16.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/crc16.c -o ${OBJECTDIR}/src/crc16.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/crc16.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/crc16.c -o ${OBJECTDIR}/src/crc16.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/crc16.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/crc16.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA1.o: src/HBA1.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA1.o.d @${RM} ${OBJECTDIR}/src/HBA1.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1.c -o ${OBJECTDIR}/src/HBA1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1.c -o ${OBJECTDIR}/src/HBA1.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA1.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA2.o: src/HBA2.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA2.o.d @${RM} ${OBJECTDIR}/src/HBA2.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2.c -o ${OBJECTDIR}/src/HBA2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2.c -o ${OBJECTDIR}/src/HBA2.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA2.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA2_RX.o: src/HBA2_RX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA2_RX.o.d @${RM} ${OBJECTDIR}/src/HBA2_RX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2_RX.c -o ${OBJECTDIR}/src/HBA2_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2_RX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2_RX.c -o ${OBJECTDIR}/src/HBA2_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2_RX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA2_RX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA2_TX.o: src/HBA2_TX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA2_TX.o.d @${RM} ${OBJECTDIR}/src/HBA2_TX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2_TX.c -o ${OBJECTDIR}/src/HBA2_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2_TX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA2_TX.c -o ${OBJECTDIR}/src/HBA2_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA2_TX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA2_TX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA3.o: src/HBA3.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA3.o.d @${RM} ${OBJECTDIR}/src/HBA3.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3.c -o ${OBJECTDIR}/src/HBA3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3.c -o ${OBJECTDIR}/src/HBA3.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA3.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA3_RX.o: src/HBA3_RX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA3_RX.o.d @${RM} ${OBJECTDIR}/src/HBA3_RX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3_RX.c -o ${OBJECTDIR}/src/HBA3_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3_RX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3_RX.c -o ${OBJECTDIR}/src/HBA3_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3_RX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA3_RX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA3_TX.o: src/HBA3_TX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA3_TX.o.d @${RM} ${OBJECTDIR}/src/HBA3_TX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3_TX.c -o ${OBJECTDIR}/src/HBA3_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3_TX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA3_TX.c -o ${OBJECTDIR}/src/HBA3_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA3_TX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA3_TX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA1_TX.o: src/HBA1_TX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA1_TX.o.d @${RM} ${OBJECTDIR}/src/HBA1_TX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1_TX.c -o ${OBJECTDIR}/src/HBA1_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1_TX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1_TX.c -o ${OBJECTDIR}/src/HBA1_TX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1_TX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA1_TX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/src/HBA1_RX.o: src/HBA1_RX.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/src" @${RM} ${OBJECTDIR}/src/HBA1_RX.o.d @${RM} ${OBJECTDIR}/src/HBA1_RX.o - ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1_RX.c -o ${OBJECTDIR}/src/HBA1_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1_RX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) src/HBA1_RX.c -o ${OBJECTDIR}/src/HBA1_RX.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/src/HBA1_RX.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/src/HBA1_RX.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/main.o: main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/main.o.d @${RM} ${OBJECTDIR}/main.o - ${MP_CC} $(MP_EXTRA_CC_PRE) main.c -o ${OBJECTDIR}/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/main.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_CC_PRE) main.c -o ${OBJECTDIR}/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/main.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -msmall-data -O2 -msmart-io=1 -Wall -msfr-warn=off -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif @@ -539,7 +539,7 @@ ${OBJECTDIR}/mcc_generated_files/memory/flash.o: mcc_generated_files/memory/flas @${MKDIR} "${OBJECTDIR}/mcc_generated_files/memory" @${RM} ${OBJECTDIR}/mcc_generated_files/memory/flash.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/memory/flash.o - ${MP_CC} $(MP_EXTRA_AS_PRE) mcc_generated_files/memory/flash.s -o ${OBJECTDIR}/mcc_generated_files/memory/flash.o -c -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc -Wa,-MD,"${OBJECTDIR}/mcc_generated_files/memory/flash.o.d",--defsym=__MPLAB_BUILD=1,--defsym=__ICD2RAM=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,--defsym=__MPLAB_DEBUGGER_PK3=1,-g,--no-relax$(MP_EXTRA_AS_POST) -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_AS_PRE) mcc_generated_files/memory/flash.s -o ${OBJECTDIR}/mcc_generated_files/memory/flash.o -c -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc -Wa,-MD,"${OBJECTDIR}/mcc_generated_files/memory/flash.o.d",--defsym=__MPLAB_BUILD=1,--defsym=__ICD2RAM=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,,-g,--no-relax$(MP_EXTRA_AS_POST) -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/memory/flash.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else @@ -547,7 +547,7 @@ ${OBJECTDIR}/mcc_generated_files/memory/flash.o: mcc_generated_files/memory/flas @${MKDIR} "${OBJECTDIR}/mcc_generated_files/memory" @${RM} ${OBJECTDIR}/mcc_generated_files/memory/flash.o.d @${RM} ${OBJECTDIR}/mcc_generated_files/memory/flash.o - ${MP_CC} $(MP_EXTRA_AS_PRE) mcc_generated_files/memory/flash.s -o ${OBJECTDIR}/mcc_generated_files/memory/flash.o -c -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc -Wa,-MD,"${OBJECTDIR}/mcc_generated_files/memory/flash.o.d",--defsym=__MPLAB_BUILD=1,-g,--no-relax$(MP_EXTRA_AS_POST) -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_AS_PRE) mcc_generated_files/memory/flash.s -o ${OBJECTDIR}/mcc_generated_files/memory/flash.o -c -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc -Wa,-MD,"${OBJECTDIR}/mcc_generated_files/memory/flash.o.d",--defsym=__MPLAB_BUILD=1,-g,--no-relax$(MP_EXTRA_AS_POST) -mdfp="${DFP_DIR}/xc16" @${FIXDEPS} "${OBJECTDIR}/mcc_generated_files/memory/flash.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif @@ -563,13 +563,13 @@ endif ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/rcu2hbat.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} - ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/rcu2hbat.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81B -mreserve=data@0x81C:0x81D -mreserve=data@0x81E:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x827 -mreserve=data@0x82A:0x84F -Wl,--local-stack,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/rcu2hbat.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,--local-stack,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) -mdfp="${DFP_DIR}/xc16" else dist/${CND_CONF}/${IMAGE_TYPE}/rcu2hbat.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} - ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/rcu2hbat.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,--local-stack,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) -mdfp=${DFP_DIR}/xc16 - ${MP_CC_DIR}/xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/rcu2hbat.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf -mdfp=${DFP_DIR}/xc16 + ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/rcu2hbat.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,--local-stack,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) -mdfp="${DFP_DIR}/xc16" + ${MP_CC_DIR}/xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/rcu2hbat.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf -mdfp="${DFP_DIR}/xc16" endif diff --git a/nbproject/Makefile-genesis.properties b/nbproject/Makefile-genesis.properties index 375e56dfd57d0c34f6284dedd5c5af53ffbfcd48..9526772394786065c95cdff7af1c68f166acb905 100644 --- a/nbproject/Makefile-genesis.properties +++ b/nbproject/Makefile-genesis.properties @@ -1,10 +1,10 @@ # -#Tue Feb 02 20:19:53 CET 2021 -default.Pack.dfplocation=/opt/microchip/mplabx/v5.35/packs/Microchip/PIC24F-GA-GB_DFP/1.2.101 -default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=859fc649e7017fd01769e2187e1537a7 +#Mon Jun 07 12:15:54 CEST 2021 +default.Pack.dfplocation=/opt/microchip/mplabx/v5.40/packs/Microchip/PIC24F-GA-GB_DFP/1.3.109 +default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=6c45d321f797d8e29b80086da23c0652 default.languagetoolchain.dir=/opt/microchip/xc16/v1.50/bin -configurations-xml=30daf9592cbcf144abd92ef4555090a5 -com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=5db0f4d6bbe0ec2a1f1096ccfb9d7ad3 +configurations-xml=b6bcda1ae27b24d5dff7ad59f42cfab8 +com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=9db8f8a224aa17d0023ea7f468f871dc default.languagetoolchain.version=1.50 host.platform=linux conf.ids=default diff --git a/nbproject/Makefile-local-default.mk b/nbproject/Makefile-local-default.mk index 5586d2dc7d42af6f1b13d1d2ba18712dd844855c..29e91090774221e3dc2bbc44a596ffb4f9fd0891 100644 --- a/nbproject/Makefile-local-default.mk +++ b/nbproject/Makefile-local-default.mk @@ -14,11 +14,11 @@ # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # -PATH_TO_IDE_BIN=/opt/microchip/mplabx/v5.35/mplab_platform/platform/../mplab_ide/modules/../../bin/ +PATH_TO_IDE_BIN=/opt/microchip/mplabx/v5.40/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. -PATH:=/opt/microchip/mplabx/v5.35/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) +PATH:=/opt/microchip/mplabx/v5.40/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created -MP_JAVA_PATH="/home/software/microchip/mplabx/v5.35/sys/java/jre1.8.0_181/bin/" +MP_JAVA_PATH="/opt/microchip/mplabx/v5.40/sys/java/zulu8.36.0.1-ca-fx-jdk8.0.202-linux_x64/jre/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="/opt/microchip/xc16/v1.50/bin/xc16-gcc" # MP_CPPC is not defined @@ -26,7 +26,7 @@ MP_CC="/opt/microchip/xc16/v1.50/bin/xc16-gcc" MP_AS="/opt/microchip/xc16/v1.50/bin/xc16-as" MP_LD="/opt/microchip/xc16/v1.50/bin/xc16-ld" MP_AR="/opt/microchip/xc16/v1.50/bin/xc16-ar" -DEP_GEN=${MP_JAVA_PATH}java -jar "/opt/microchip/mplabx/v5.35/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" +DEP_GEN=${MP_JAVA_PATH}java -jar "/opt/microchip/mplabx/v5.40/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="/opt/microchip/xc16/v1.50/bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined @@ -34,4 +34,4 @@ MP_AS_DIR="/opt/microchip/xc16/v1.50/bin" MP_LD_DIR="/opt/microchip/xc16/v1.50/bin" MP_AR_DIR="/opt/microchip/xc16/v1.50/bin" # MP_BC_DIR is not defined -DFP_DIR="/opt/microchip/mplabx/v5.35/packs/Microchip/PIC24F-GA-GB_DFP/1.2.101" +DFP_DIR=/opt/microchip/mplabx/v5.40/packs/Microchip/PIC24F-GA-GB_DFP/1.3.109 diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 30e4c154b1ea1349e2eb7cbb0666cecf0b1edb71..d3ca231aa1b14de9c6cfdaa5a4f1ad7c39dbde5f 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -110,14 +110,16 @@ <targetDevice>PIC24FJ64GA702</targetDevice> <targetHeader></targetHeader> <targetPluginBoard></targetPluginBoard> - <platformTool>PICkit3PlatformTool</platformTool> + <platformTool>noID</platformTool> <languageToolchain>XC16</languageToolchain> <languageToolchainVersion>1.50</languageToolchainVersion> <platform>2</platform> </toolsSet> <packs> - <pack name="PIC24F-GA-GB_DFP" vendor="Microchip" version="1.2.101"/> + <pack name="PIC24F-GA-GB_DFP" vendor="Microchip" version="1.3.109"/> </packs> + <ScriptingSettings> + </ScriptingSettings> <compileType> <linkerTool> <linkerLibItems> @@ -308,7 +310,6 @@ <property key="UART 1" value="true"/> <property key="UART 2" value="true"/> <property key="debugoptions.useswbreakpoints" value="false"/> - <property key="firmware.download.all" value="false"/> <property key="hwtoolclock.frcindebug" value="false"/> <property key="memories.aux" value="false"/> <property key="memories.bootflash" value="true"/> @@ -344,6 +345,18 @@ <property key="voltagevalue" value="3.25"/> </PICkit3PlatformTool> <item path="mainloop.c" ex="true" overriding="false"> + <C30> + </C30> + <C30-AR> + </C30-AR> + <C30-AS> + </C30-AS> + <C30-CO> + </C30-CO> + <C30-LD> + </C30-LD> + <C30Global> + </C30Global> </item> </conf> </confs> diff --git a/nbproject/private/configurations.xml b/nbproject/private/configurations.xml index 2eb733e8951ff6246dfd52f59877cbe7cdd24bb2..9613344fc96ea7ddc16647a07782e379280db8c0 100644 --- a/nbproject/private/configurations.xml +++ b/nbproject/private/configurations.xml @@ -4,7 +4,7 @@ <defaultConf>0</defaultConf> <confs> <conf name="default" type="2"> - <platformToolSN>:=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>900A:=<rev>0002:=<man>Microchip Technology Inc.:=<prod>PICkit 3:=<sn>BUR121090214:=<drv>x:=<xpt>h:=end</platformToolSN> + <platformToolSN>noToolString</platformToolSN> <languageToolchainDir>/opt/microchip/xc16/v1.50/bin</languageToolchainDir> <mdbdebugger version="1"> <placeholder1>place holder 1</placeholder1> diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 6807a2ba1902a255b464065dd83188d73fbe6d01..d846565c3d00f547c44a735c13c73c1d973becaa 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -2,6 +2,22 @@ <project-private xmlns="http://www.netbeans.org/ns/project-private/1"> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> - <group/> + <group> + <file>file:/home/kruger/git/rcu2hbat/src/HBAx_i2c.c</file> + <file>file:/home/kruger/git/rcu2hbat/src/registers.h</file> + <file>file:/home/kruger/git/rcu2hbat/src/HBAx.c</file> + <file>file:/home/kruger/git/rcu2hbat/src/HBA2.h</file> + <file>file:/home/kruger/git/rcu2hbat/src/HBA1.h</file> + <file>file:/home/kruger/git/rcu2hbat/src/HBA3.h</file> + <file>file:/home/kruger/git/rcu2hbat/src/HBA2.c</file> + <file>file:/home/kruger/git/rcu2hbat/src/HBAx_RX.c</file> + <file>file:/home/kruger/git/rcu2hbat/mcc_generated_files/i2c1.c</file> + <file>file:/home/kruger/git/rcu2hbat/src/HBAx_TX.c</file> + <file>file:/home/kruger/git/rcu2hbat/src/rcu2_i2c.c</file> + <file>file:/home/kruger/git/rcu2hbat/src/registers.c</file> + <file>file:/home/kruger/git/rcu2hbat/src/HBA3_TX.h</file> + <file>file:/home/kruger/git/rcu2hbat/src/rcu2_i2c.h</file> + <file>file:/home/kruger/git/rcu2hbat/main.c</file> + </group> </open-files> </project-private> diff --git a/scripts/.ipynb_checkpoints/testHBAT2-checkpoint.ipynb b/scripts/.ipynb_checkpoints/testHBAT2-checkpoint.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..a8fae43857f1b7a6eabc12897bea3824f8bb1bf1 --- /dev/null +++ b/scripts/.ipynb_checkpoints/testHBAT2-checkpoint.ipynb @@ -0,0 +1,601 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Uses pi pico with l2hbat_pico program" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import serial\n", + "import hbat1 as hb\n", + "from time import sleep" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "Debug=True;" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/dev/ttyACM0\n" + ] + } + ], + "source": [ + "ser = serial.Serial('/dev/ttyACM0',115200,timeout=0.5) # open serial port\n", + "print(ser.name) # check which port was really used" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "def GetPackets():\n", + " D=hb.GetDelay(ser);\n", + " D2=hb.NormDelays(D)\n", + " #print(\"Received delays:\",D2[:10])\n", + " S=hb.Decode(D2)\n", + " RXdata=[]\n", + " #print(\"Received packets:\",S)\n", + " while len(S)>0:\n", + " L=S[1]\n", + " S1=S[:L+3]\n", + " CRC=hb.CRCcheck(S1);\n", + " if Debug: print(\"Received packet:\",S1,\"CRC=\",CRC)\n", + " #if (CRC==0) and (S1[0]>0x80):\n", + " if (S1[0]<=0x10):\n", + " #print(\"Reply from Addr=\",S1[0]-0x80,\" data=\",S[2:-2])\n", + " RXdata=S[2:-2] \n", + " if Debug: print(\"Reply from Addr=\",S1[0]-0x80,\" data=\",[hex(a) for a in RXdata])\n", + " S=S[L+3:]\n", + " return RXdata;" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "def SetRegisters(reg,data):\n", + " func=len(data)*2;\n", + " TX1=hb.MakeRequest(HBA_select,data,func,reg);\n", + " if Debug: print(\"Packet to TX\",TX1)\n", + " TX2=hb.ManchesterEncode(TX1)\n", + " ser.write(bytearray(TX2))\n", + " GetPackets();\n", + "def RequestRegisters(reg,length):\n", + " func=length*2+1;\n", + " TX1=hb.MakeRequest(HBA_select,[],func,reg);\n", + " if Debug: print(\"Packet to TX\",TX1)\n", + " TX2=hb.ManchesterEncode(TX1)\n", + " ser.write(bytearray(TX2))\n", + " return GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "def NormDelays2(D,offset=19,scale=20):\n", + " return [(d+offset)/scale for d in D] #shorter (inbetween) delay = waiting for FIFO\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.1\n" + ] + } + ], + "source": [ + "D=[]\n", + "import numpy as np\n", + "while len(D)==0:\n", + " D=hb.GetDelay(ser);\n", + " D2=NormDelays2(D,offset=22)\n", + " D3=[np.abs(d-np.round(d))*(d<5) for d in D2]\n", + " if len(D)>0: \n", + " #print(D3)\n", + " print(np.max(np.array(D3)))" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Received packet: [0, 37, 4, 0, 1, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 60, 16] CRC= 49345\n", + "Reply from Addr= -128 data= ['0x4', '0x0', '0x1', '0x10', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x4', '0x3c', '0x10', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x5', '0x3', '0x5', '0x0', '0xf2', '0x5c', '0x6', '0x3', '0x5', '0x0', '0xf3', '0xd8', '0x7', '0x3', '0x5', '0x0', '0xf3', '0xe4', '0x8', '0x3', '0x5', '0x0', '0xf0', '0xf0', '0x9', '0x3', '0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [1, 3, 5, 0, 242, 172] CRC= 0\n", + "Reply from Addr= -127 data= ['0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x5', '0x3', '0x5', '0x0', '0xf2', '0x5c', '0x6', '0x3', '0x5', '0x0', '0xf3', '0xd8', '0x7', '0x3', '0x5', '0x0', '0xf3', '0xe4', '0x8', '0x3', '0x5', '0x0', '0xf0', '0xf0', '0x9', '0x3', '0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [2, 3, 5, 0, 243, 40] CRC= 0\n", + "Reply from Addr= -126 data= ['0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x5', '0x3', '0x5', '0x0', '0xf2', '0x5c', '0x6', '0x3', '0x5', '0x0', '0xf3', '0xd8', '0x7', '0x3', '0x5', '0x0', '0xf3', '0xe4', '0x8', '0x3', '0x5', '0x0', '0xf0', '0xf0', '0x9', '0x3', '0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [3, 3, 5, 0, 243, 20] CRC= 0\n", + "Reply from Addr= -125 data= ['0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x5', '0x3', '0x5', '0x0', '0xf2', '0x5c', '0x6', '0x3', '0x5', '0x0', '0xf3', '0xd8', '0x7', '0x3', '0x5', '0x0', '0xf3', '0xe4', '0x8', '0x3', '0x5', '0x0', '0xf0', '0xf0', '0x9', '0x3', '0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [4, 3, 5, 0, 242, 96] CRC= 0\n", + "Reply from Addr= -124 data= ['0x5', '0x0', '0xf2', '0x60', '0x5', '0x3', '0x5', '0x0', '0xf2', '0x5c', '0x6', '0x3', '0x5', '0x0', '0xf3', '0xd8', '0x7', '0x3', '0x5', '0x0', '0xf3', '0xe4', '0x8', '0x3', '0x5', '0x0', '0xf0', '0xf0', '0x9', '0x3', '0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [5, 3, 5, 0, 242, 92] CRC= 0\n", + "Reply from Addr= -123 data= ['0x5', '0x0', '0xf2', '0x5c', '0x6', '0x3', '0x5', '0x0', '0xf3', '0xd8', '0x7', '0x3', '0x5', '0x0', '0xf3', '0xe4', '0x8', '0x3', '0x5', '0x0', '0xf0', '0xf0', '0x9', '0x3', '0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [6, 3, 5, 0, 243, 216] CRC= 0\n", + "Reply from Addr= -122 data= ['0x5', '0x0', '0xf3', '0xd8', '0x7', '0x3', '0x5', '0x0', '0xf3', '0xe4', '0x8', '0x3', '0x5', '0x0', '0xf0', '0xf0', '0x9', '0x3', '0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [7, 3, 5, 0, 243, 228] CRC= 0\n", + "Reply from Addr= -121 data= ['0x5', '0x0', '0xf3', '0xe4', '0x8', '0x3', '0x5', '0x0', '0xf0', '0xf0', '0x9', '0x3', '0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [8, 3, 5, 0, 240, 240] CRC= 0\n", + "Reply from Addr= -120 data= ['0x5', '0x0', '0xf0', '0xf0', '0x9', '0x3', '0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [9, 3, 5, 0, 240, 204] CRC= 0\n", + "Reply from Addr= -119 data= ['0x5', '0x0', '0xf0', '0xcc', '0xa', '0x3', '0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [10, 3, 5, 0, 241, 72] CRC= 0\n", + "Reply from Addr= -118 data= ['0x5', '0x0', '0xf1', '0x48', '0xb', '0x3', '0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [11, 3, 5, 0, 241, 116] CRC= 0\n", + "Reply from Addr= -117 data= ['0x5', '0x0', '0xf1', '0x74', '0xc', '0x3', '0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [12, 3, 5, 0, 240, 0] CRC= 0\n", + "Reply from Addr= -116 data= ['0x5', '0x0', '0xf0', '0x0', '0xd', '0x3', '0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [13, 3, 5, 0, 240, 60] CRC= 0\n", + "Reply from Addr= -115 data= ['0x5', '0x0', '0xf0', '0x3c', '0xe', '0x3', '0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [14, 3, 5, 0, 241, 184] CRC= 0\n", + "Reply from Addr= -114 data= ['0x5', '0x0', '0xf1', '0xb8', '0xf', '0x3', '0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [15, 3, 5, 0, 241, 132] CRC= 0\n", + "Reply from Addr= -113 data= ['0x5', '0x0', '0xf1', '0x84', '0x10', '0x3', '0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [16, 3, 5, 0, 246, 80] CRC= 0\n", + "Reply from Addr= -112 data= ['0x5', '0x0', '0xf6', '0x50', '0x0', '0x25', '0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [0, 37, 4, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 204] CRC= 49473\n", + "Reply from Addr= -128 data= ['0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [1, 3, 5, 0, 242, 172] CRC= 0\n", + "Reply from Addr= -127 data= ['0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [2, 3, 5, 0, 243, 40] CRC= 0\n", + "Reply from Addr= -126 data= ['0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [3, 3, 5, 0, 243, 20] CRC= 0\n", + "Reply from Addr= -125 data= ['0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [4, 3, 5, 0, 242, 96] CRC= 0\n", + "Reply from Addr= -124 data= ['0x5', '0x0', '0xf2', '0x60', '0x1']\n", + "Received packet: [1, 236, 161] CRC= 30941\n", + "Reply from Addr= -127 data= []\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Received packet: [0, 37, 4, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 204] CRC= 49473\n", + "Reply from Addr= -128 data= ['0x4', '0x0', '0x1', '0x10', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x13', '0xcc', '0x1', '0x3', '0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0xfe']\n", + "Received packet: [1, 3, 5, 0, 242, 172] CRC= 0\n", + "Reply from Addr= -127 data= ['0x5', '0x0', '0xf2', '0xac', '0x2', '0x3', '0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0xfe']\n", + "Received packet: [2, 3, 5, 0, 243, 40] CRC= 0\n", + "Reply from Addr= -126 data= ['0x5', '0x0', '0xf3', '0x28', '0x3', '0x3', '0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0xfe']\n", + "Received packet: [3, 3, 5, 0, 243, 20] CRC= 0\n", + "Reply from Addr= -125 data= ['0x5', '0x0', '0xf3', '0x14', '0x4', '0x3', '0x5', '0x0', '0xf2', '0x60', '0xfe']\n", + "Received packet: [4, 3, 5, 0, 242, 96] CRC= 0\n", + "Reply from Addr= -124 data= ['0x5', '0x0', '0xf2', '0x60', '0xfe']\n", + "Received packet: [254, 12, 161] CRC= 18597\n", + "[5, 0, 242, 96, 254]\n" + ] + } + ], + "source": [ + "S=[]\n", + "while len(S)==0: S=GetPackets();\n", + "print(S)" + ] + }, + { + "cell_type": "code", + "execution_count": 260, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x0', '0x75', '0x4d', '0x4a']\n", + "Reply from Addr= 3 data= ['0xf2', '0x94', '0x90', '0xf2']\n" + ] + } + ], + "source": [ + "#Request ID & Version\n", + "for HBA_select in range(15):\n", + " RequestRegisters(HBA_ID,4);\n", + "HBA_select=3\n", + "RequestRegisters(HBA_VERSION,4);" + ] + }, + { + "cell_type": "code", + "execution_count": 303, + "metadata": {}, + "outputs": [], + "source": [ + "#Put LEDS on\n", + "SetRegisters(HBA_PWR,[0x3]);" + ] + }, + { + "cell_type": "code", + "execution_count": 304, + "metadata": {}, + "outputs": [], + "source": [ + "#Put Analog LDO-X on\n", + "#Power Register 0xB: \n", + "#0x01: LED1\n", + "#0x02: LED2\n", + "#0x04: Power X-BF\n", + "#0x08: Power Y-BF\n", + "#0x10: EN-FE power??\n", + "SetRegisters(HBA_PWR,[0x04]);" + ] + }, + { + "cell_type": "code", + "execution_count": 305, + "metadata": {}, + "outputs": [], + "source": [ + "#Antenna power\n", + "#Enable FE LDOs\n", + "SetRegisters(HBA_PWR,[0x14]);" + ] + }, + { + "cell_type": "code", + "execution_count": 306, + "metadata": {}, + "outputs": [], + "source": [ + "#Enable all FE\n", + "SetRegisters(HBA_FE_PWR,[0x0F]);" + ] + }, + { + "cell_type": "code", + "execution_count": 307, + "metadata": {}, + "outputs": [], + "source": [ + "#Set output switch = G1\n", + "#Output switch: 0=G1, 2=G4, 1(4)=G3, 6(3)=All, 4(1)=G2 (Bits swapped!)\n", + "SetRegisters(HBA_SWX,[4]);" + ] + }, + { + "cell_type": "code", + "execution_count": 308, + "metadata": {}, + "outputs": [], + "source": [ + "#Set output switch = BF, BFon\n", + "#BF (8) =on\n", + "SetRegisters(HBA_SWX,[8+6]);" + ] + }, + { + "cell_type": "code", + "execution_count": 309, + "metadata": {}, + "outputs": [], + "source": [ + "SetRegisters(HBA_X,[0xF0]*4);" + ] + }, + { + "cell_type": "code", + "execution_count": 310, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0xf0', '0xf0']\n" + ] + } + ], + "source": [ + "RequestRegisters(1,2);" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 3, 21, 0, 254, 232]\n", + "Received packet: [2, 3, 21, 0, 254, 232] CRC= 0\n", + "Received packet: [130, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 93] CRC= 0\n", + "Reply from Addr= 2 data= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n" + ] + } + ], + "source": [ + "#Request all the uC settings:\n", + "RequestRegisters(0,0xA);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 144, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [3, 3, 27, 16, 251, 120]\n", + "Received packet: [3, 3, 27, 16, 251, 120] CRC= 0\n" + ] + } + ], + "source": [ + "#Request all the uC settings:\n", + "RequestRegisters(0x10,0xD);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "ser.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 4, 2, 11, 3, 159, 193]\n", + "Received packet: [2, 4, 2, 11, 3, 159, 193] CRC= 0\n" + ] + } + ], + "source": [ + "SetRegisters(0xB,[3]);#LEDS on\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 150, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 3, 37, 16, 234, 228]\n", + "Received packet: [2, 3, 37, 16, 234, 228] CRC= 0\n", + "Received packet: [130, 19, 0, 117, 77, 74, 255, 2, 125, 175, 88, 0, 0, 4, 0, 80, 0, 2, 3, 4, 47, 48] CRC= 0\n", + "Reply from Addr= 2 data= [0, 117, 77, 74, 255, 2, 125, 175, 88, 0, 0, 4, 0, 80, 0, 2, 3, 4]\n" + ] + } + ], + "source": [ + "#Request registers\n", + "RequestRegisters(0x10,18);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 212, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [15, 3, 9, 16, 245, 72]\n", + "Received packet: [15, 3, 9, 16, 245, 72] CRC= 0\n" + ] + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 236, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x3']\n" + ] + } + ], + "source": [ + "def SetAddress(HBA_select_new):\n", + " global HBA_select;\n", + " SetRegisters(HBA_ADDR,[HBA_select_new]);#Change address\n", + " HBA_select=HBA_select_new\n", + " GetPackets();\n", + " RequestRegisters(HBA_ADDR,1);\n", + " GetPackets();\n", + "SetAddress(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 147, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 5, 4, 32, 3, 4, 205, 235]\n", + "Received packet: [2, 5, 4, 32, 3, 4, 205, 235] CRC= 0\n", + "Packet to TX [2, 3, 5, 32, 243, 48]\n", + "Received packet: [2, 3, 5, 32, 243, 48] CRC= 0\n", + "Received packet: [130, 3, 3, 4, 217, 75] CRC= 0\n", + "Reply from Addr= 2 data= [3, 4]\n" + ] + } + ], + "source": [ + "SetRegisters(0x20,[3,4]);#test - not used\n", + "GetPackets();\n", + "RequestRegisters(0x20,2);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 237, + "metadata": {}, + "outputs": [], + "source": [ + "RequestRegisters(HBA_SAVE_EEPROM,1);" + ] + }, + { + "cell_type": "code", + "execution_count": 267, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x0', '0x75', '0x4d', '0x4a', '0xf2', '0x94', '0x90', '0xf2']\n", + "Reply from Addr= 3 data= ['0x3', '0x0', '0x7d', '0x2', '0x7d', '0xaf', '0x58', '0x0', '0x0', '0x4', '0x0', '0x50']\n" + ] + } + ], + "source": [ + "SetRegisters(HBA_LOAD_EEPROM,[])\n", + "#Request registers\n", + "RequestRegisters(0x10,8);\n", + "RequestRegisters(0x20,12);" + ] + }, + { + "cell_type": "code", + "execution_count": 268, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x0', '0x75', '0x4d', '0x4a', '0xf2', '0x94', '0x90', '0xf2']\n", + "Reply from Addr= 3 data= ['0x3', '0x0', '0x7d', '0x2', '0x7d', '0xaf', '0x58', '0x0', '0x0', '0x4', '0x0', '0x50']\n" + ] + } + ], + "source": [ + "#Request registers\n", + "RequestRegisters(0x10,8);\n", + "RequestRegisters(0x20,12);" + ] + }, + { + "cell_type": "code", + "execution_count": 311, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x2', '0x4c']\n", + "scale= 0.01219482421875\n", + "Vsense= 7.170556640625\n" + ] + } + ], + "source": [ + "V=RequestRegisters(HBA_VSENSE,1);\n", + "V1=V[0]*256+V[1]\n", + "Vref=3.33\n", + "R1=1.2 #kOhm\n", + "R2=3.3 #kOhm\n", + "Div=R1/(R1+R2)\n", + "print('scale=',1/(2**10)*Vref/Div)\n", + "V1=V1/(2**10)*Vref/Div\n", + "print(\"Vsense=\",V1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/scripts/.ipynb_checkpoints/testHBAT2b-checkpoint.ipynb b/scripts/.ipynb_checkpoints/testHBAT2b-checkpoint.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..1310886d72abd566fcdaaa01f1664dab7898e7c9 --- /dev/null +++ b/scripts/.ipynb_checkpoints/testHBAT2b-checkpoint.ipynb @@ -0,0 +1,622 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Uses pi pico with l2hbat_pico program" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import serial\n", + "import hbat1 as hb\n", + "from time import sleep" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [], + "source": [ + "Debug=False;" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/dev/ttyACM0\n" + ] + } + ], + "source": [ + "ser = serial.Serial('/dev/ttyACM0',115200,timeout=0.1) # open serial port\n", + "print(ser.name) # check which port was really used" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [], + "source": [ + "def GetPackets():\n", + " D=hb.GetDelay(ser);\n", + " D2=hb.NormDelays(D)\n", + " #print(\"Received delays:\",D2[:10])\n", + " S=hb.Decode(D2)\n", + " RXdata=[]\n", + " #print(\"Received packets:\",S)\n", + " while len(S)>0:\n", + " L=S[1]\n", + " S1=S[:L+3]\n", + " CRC=hb.CRCcheck(S1);\n", + " if Debug: print(\"Received packet:\",S1,\"CRC=\",CRC)\n", + " #if (CRC==0) and (S1[0]>0x80):\n", + " if (S1[0]<=0x10):\n", + " #print(\"Reply from Addr=\",S1[0]-0x80,\" data=\",S[2:-2])\n", + " RXdata=S1[2:-2].copy()\n", + "# print(\"Reply from Addr=\",S1[0],\" data=\",[hex(a) for a in RXdata])\n", + " print(\"Addr=\",S1[0],\" data=\",RXdata)\n", + " S=S[L+3:]\n", + " return RXdata;" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [], + "source": [ + "def SetRegisters(reg,data):\n", + " func=len(data)*2;\n", + " TX1=hb.MakeRequest(HBA_select,data,func,reg);\n", + " if Debug: print(\"Packet to TX\",TX1)\n", + " TX2=hb.ManchesterEncode(TX1)\n", + " ser.write(bytearray(TX2))\n", + " GetPackets();\n", + "def RequestRegisters(reg,length):\n", + " func=length*2+1;\n", + " TX1=hb.MakeRequest(HBA_select,[],func,reg);\n", + " if Debug: print(\"Packet to TX\",TX1)\n", + " TX2=hb.ManchesterEncode(TX1)\n", + " ser.write(bytearray(TX2))\n", + " return GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "def NormDelays2(D,offset=19,scale=20):\n", + " return [(d+offset)/scale for d in D] #shorter (inbetween) delay = waiting for FIFO\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.1\n" + ] + } + ], + "source": [ + "D=[]\n", + "import numpy as np\n", + "while len(D)==0:\n", + " D=hb.GetDelay(ser);\n", + " D2=NormDelays2(D,offset=22)\n", + " D3=[np.abs(d-np.round(d))*(d<5) for d in D2]\n", + " if len(D)>0: \n", + " #print(D3)\n", + " print(np.max(np.array(D3)))" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Addr= 0 data= [4, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n", + "Addr= 1 data= [5, 0]\n", + "Addr= 2 data= [5, 0]\n", + "Addr= 3 data= [5, 0]\n", + "Addr= 4 data= [5, 0]\n", + "Addr= 5 data= [5, 0]\n", + "Addr= 6 data= [5, 0]\n", + "Addr= 7 data= [5, 0]\n", + "Addr= 8 data= [5, 0]\n", + "Addr= 9 data= [5, 0]\n", + "Addr= 10 data= [5, 0]\n", + "Addr= 11 data= [5, 0]\n", + "Addr= 12 data= [5, 0]\n", + "Addr= 13 data= [5, 0]\n", + "Addr= 14 data= [5, 0]\n", + "Addr= 15 data= [5, 0]\n", + "Addr= 16 data= [5, 0]\n", + "Addr= 0 data= [4, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n", + "Addr= 1 data= [5, 0]\n", + "Addr= 2 data= [5, 0]\n", + "Addr= 3 data= [5, 0]\n", + "Addr= 4 data= [5, 0]\n", + "Addr= 5 data= [5, 0]\n", + "Addr= 6 data= [5, 0]\n", + "Addr= 7 data= [5, 0]\n", + "Addr= 8 data= [5, 0]\n", + "Addr= 9 data= [5, 0]\n", + "Addr= 10 data= [5, 0]\n", + "Addr= 11 data= [5, 0]\n", + "Addr= 12 data= [5, 0]\n", + "Addr= 13 data= [5, 0]\n", + "Addr= 14 data= [5, 0]\n", + "Addr= 15 data= [5, 0]\n", + "Addr= 16 data= [5, 0]\n", + "Addr= 0 data= [4, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n", + "Addr= 1 data= [5, 0]\n", + "Addr= 2 data= [5, 0]\n", + "Addr= 3 data= [5, 0]\n", + "Addr= 4 data= [5, 0]\n", + "Addr= 5 data= [5, 0]\n", + "Addr= 6 data= [5, 0]\n", + "Addr= 7 data= [5, 0]\n", + "Addr= 8 data= [5, 0]\n", + "Addr= 9 data= [5, 0]\n", + "Addr= 10 data= [5, 0]\n", + "Addr= 11 data= [5, 0]\n", + "Addr= 12 data= [5, 0]\n", + "Addr= 13 data= [5, 0]\n", + "Addr= 14 data= [5, 0]\n", + "Addr= 15 data= [5, 0]\n", + "Addr= 16 data= [5, 0]\n", + "Addr= 0 data= [4, 0, 1, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]\n", + "Addr= 1 data= [5, 0]\n", + "Addr= 2 data= [5, 0]\n", + "Addr= 3 data= [5, 0]\n", + "Addr= 4 data= [5, 0]\n", + "Addr= 5 data= [5, 0]\n", + "Addr= 6 data= [5, 0]\n", + "Addr= 7 data= [5, 0]\n", + "Addr= 8 data= [5, 0]\n", + "Addr= 9 data= [5, 0]\n", + "Addr= 10 data= [5, 0]\n", + "Addr= 11 data= [5, 0]\n", + "Addr= 12 data= [5, 0]\n", + "Addr= 13 data= [5, 0]\n", + "Addr= 14 data= [5, 0]\n", + "Addr= 15 data= [5, 0]\n", + "Addr= 16 data= [5, 0]\n", + "Addr= 0 data= [4, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8]\n", + "Addr= 1 data= [5, 0]\n", + "Addr= 2 data= [5, 0]\n", + "Addr= 3 data= [5, 0]\n", + "Addr= 4 data= [5, 0]\n", + "Addr= 5 data= [5, 0]\n", + "Addr= 6 data= [5, 0]\n", + "Addr= 7 data= [5, 0]\n", + "Addr= 8 data= [5, 0]\n", + "Addr= 9 data= [5, 0]\n", + "Addr= 10 data= [5, 0]\n", + "Addr= 11 data= [5, 0]\n", + "Addr= 12 data= [5, 0]\n", + "Addr= 13 data= [5, 0]\n", + "Addr= 14 data= [5, 0]\n", + "Addr= 15 data= [5, 0]\n", + "Addr= 16 data= [5, 0]\n" + ] + }, + { + "ename": "SerialException", + "evalue": "read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mSerialException\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/usr/lib/python3/dist-packages/serial/serialposix.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, size)\u001b[0m\n\u001b[1;32m 500\u001b[0m raise SerialException(\n\u001b[0;32m--> 501\u001b[0;31m \u001b[0;34m'device reports readiness to read but returned no data '\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 502\u001b[0m '(device disconnected or multiple access on port?)')\n", + "\u001b[0;31mSerialException\u001b[0m: device reports readiness to read but returned no data (device disconnected or multiple access on port?)", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mSerialException\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m<ipython-input-61-d7da1479a071>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;31m#while len(S)==0:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mS\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mGetPackets\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;31m#if len(S)==0: continue;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;31m#print(S)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m<ipython-input-58-f2e046a93826>\u001b[0m in \u001b[0;36mGetPackets\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mGetPackets\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mD\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetDelay\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mser\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mD2\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mNormDelays\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mD\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;31m#print(\"Received delays:\",D2[:10])\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mS\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mD2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/home/kruger/git/rcu2hbat/scripts/hbat1.py\u001b[0m in \u001b[0;36mGetDelay\u001b[0;34m(ser, Start)\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mStart\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0x1000\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m!=\u001b[0m\u001b[0;34mb''\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mser\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadline\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;36m8\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 10\u001b[0m \u001b[0;31m# print(a)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m==\u001b[0m\u001b[0;34mb''\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/lib/python3/dist-packages/serial/serialposix.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, size)\u001b[0m\n\u001b[1;32m 507\u001b[0m \u001b[0;31m# https://www.python.org/dev/peps/pep-0475.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 508\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0merrno\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32min\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEAGAIN\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEALREADY\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEWOULDBLOCK\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEINPROGRESS\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEINTR\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 509\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mSerialException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'read failed: {}'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 510\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0merror\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 511\u001b[0m \u001b[0;31m# this is for Python 2.x\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mSerialException\u001b[0m: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)" + ] + } + ], + "source": [ + "S=[]\n", + "#while len(S)==0:\n", + "while True:\n", + " S=GetPackets();\n", + " #if len(S)==0: continue;\n", + " #print(S)" + ] + }, + { + "cell_type": "code", + "execution_count": 303, + "metadata": {}, + "outputs": [], + "source": [ + "#Put LEDS on\n", + "SetRegisters(HBA_PWR,[0x3]);" + ] + }, + { + "cell_type": "code", + "execution_count": 304, + "metadata": {}, + "outputs": [], + "source": [ + "#Put Analog LDO-X on\n", + "#Power Register 0xB: \n", + "#0x01: LED1\n", + "#0x02: LED2\n", + "#0x04: Power X-BF\n", + "#0x08: Power Y-BF\n", + "#0x10: EN-FE power??\n", + "SetRegisters(HBA_PWR,[0x04]);" + ] + }, + { + "cell_type": "code", + "execution_count": 305, + "metadata": {}, + "outputs": [], + "source": [ + "#Antenna power\n", + "#Enable FE LDOs\n", + "SetRegisters(HBA_PWR,[0x14]);" + ] + }, + { + "cell_type": "code", + "execution_count": 306, + "metadata": {}, + "outputs": [], + "source": [ + "#Enable all FE\n", + "SetRegisters(HBA_FE_PWR,[0x0F]);" + ] + }, + { + "cell_type": "code", + "execution_count": 307, + "metadata": {}, + "outputs": [], + "source": [ + "#Set output switch = G1\n", + "#Output switch: 0=G1, 2=G4, 1(4)=G3, 6(3)=All, 4(1)=G2 (Bits swapped!)\n", + "SetRegisters(HBA_SWX,[4]);" + ] + }, + { + "cell_type": "code", + "execution_count": 308, + "metadata": {}, + "outputs": [], + "source": [ + "#Set output switch = BF, BFon\n", + "#BF (8) =on\n", + "SetRegisters(HBA_SWX,[8+6]);" + ] + }, + { + "cell_type": "code", + "execution_count": 309, + "metadata": {}, + "outputs": [], + "source": [ + "SetRegisters(HBA_X,[0xF0]*4);" + ] + }, + { + "cell_type": "code", + "execution_count": 310, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0xf0', '0xf0']\n" + ] + } + ], + "source": [ + "RequestRegisters(1,2);" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 3, 21, 0, 254, 232]\n", + "Received packet: [2, 3, 21, 0, 254, 232] CRC= 0\n", + "Received packet: [130, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 93] CRC= 0\n", + "Reply from Addr= 2 data= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n" + ] + } + ], + "source": [ + "#Request all the uC settings:\n", + "RequestRegisters(0,0xA);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 144, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [3, 3, 27, 16, 251, 120]\n", + "Received packet: [3, 3, 27, 16, 251, 120] CRC= 0\n" + ] + } + ], + "source": [ + "#Request all the uC settings:\n", + "RequestRegisters(0x10,0xD);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "ser.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 4, 2, 11, 3, 159, 193]\n", + "Received packet: [2, 4, 2, 11, 3, 159, 193] CRC= 0\n" + ] + } + ], + "source": [ + "SetRegisters(0xB,[3]);#LEDS on\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 150, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 3, 37, 16, 234, 228]\n", + "Received packet: [2, 3, 37, 16, 234, 228] CRC= 0\n", + "Received packet: [130, 19, 0, 117, 77, 74, 255, 2, 125, 175, 88, 0, 0, 4, 0, 80, 0, 2, 3, 4, 47, 48] CRC= 0\n", + "Reply from Addr= 2 data= [0, 117, 77, 74, 255, 2, 125, 175, 88, 0, 0, 4, 0, 80, 0, 2, 3, 4]\n" + ] + } + ], + "source": [ + "#Request registers\n", + "RequestRegisters(0x10,18);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 212, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [15, 3, 9, 16, 245, 72]\n", + "Received packet: [15, 3, 9, 16, 245, 72] CRC= 0\n" + ] + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 236, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x3']\n" + ] + } + ], + "source": [ + "def SetAddress(HBA_select_new):\n", + " global HBA_select;\n", + " SetRegisters(HBA_ADDR,[HBA_select_new]);#Change address\n", + " HBA_select=HBA_select_new\n", + " GetPackets();\n", + " RequestRegisters(HBA_ADDR,1);\n", + " GetPackets();\n", + "SetAddress(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 147, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 5, 4, 32, 3, 4, 205, 235]\n", + "Received packet: [2, 5, 4, 32, 3, 4, 205, 235] CRC= 0\n", + "Packet to TX [2, 3, 5, 32, 243, 48]\n", + "Received packet: [2, 3, 5, 32, 243, 48] CRC= 0\n", + "Received packet: [130, 3, 3, 4, 217, 75] CRC= 0\n", + "Reply from Addr= 2 data= [3, 4]\n" + ] + } + ], + "source": [ + "SetRegisters(0x20,[3,4]);#test - not used\n", + "GetPackets();\n", + "RequestRegisters(0x20,2);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 237, + "metadata": {}, + "outputs": [], + "source": [ + "RequestRegisters(HBA_SAVE_EEPROM,1);" + ] + }, + { + "cell_type": "code", + "execution_count": 267, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x0', '0x75', '0x4d', '0x4a', '0xf2', '0x94', '0x90', '0xf2']\n", + "Reply from Addr= 3 data= ['0x3', '0x0', '0x7d', '0x2', '0x7d', '0xaf', '0x58', '0x0', '0x0', '0x4', '0x0', '0x50']\n" + ] + } + ], + "source": [ + "SetRegisters(HBA_LOAD_EEPROM,[])\n", + "#Request registers\n", + "RequestRegisters(0x10,8);\n", + "RequestRegisters(0x20,12);" + ] + }, + { + "cell_type": "code", + "execution_count": 268, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x0', '0x75', '0x4d', '0x4a', '0xf2', '0x94', '0x90', '0xf2']\n", + "Reply from Addr= 3 data= ['0x3', '0x0', '0x7d', '0x2', '0x7d', '0xaf', '0x58', '0x0', '0x0', '0x4', '0x0', '0x50']\n" + ] + } + ], + "source": [ + "#Request registers\n", + "RequestRegisters(0x10,8);\n", + "RequestRegisters(0x20,12);" + ] + }, + { + "cell_type": "code", + "execution_count": 311, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x2', '0x4c']\n", + "scale= 0.01219482421875\n", + "Vsense= 7.170556640625\n" + ] + } + ], + "source": [ + "V=RequestRegisters(HBA_VSENSE,1);\n", + "V1=V[0]*256+V[1]\n", + "Vref=3.33\n", + "R1=1.2 #kOhm\n", + "R2=3.3 #kOhm\n", + "Div=R1/(R1+R2)\n", + "print('scale=',1/(2**10)*Vref/Div)\n", + "V1=V1/(2**10)*Vref/Div\n", + "print(\"Vsense=\",V1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/scripts/CRC_HBAT1.npy b/scripts/CRC_HBAT1.npy new file mode 100644 index 0000000000000000000000000000000000000000..c737267e6ea48a415beb618f8d8abbf5b3050a98 Binary files /dev/null and b/scripts/CRC_HBAT1.npy differ diff --git a/scripts/__pycache__/hbat1.cpython-36.pyc b/scripts/__pycache__/hbat1.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..63b5d11ae8e78d243c7f50d88ec6c29b110f8ac2 Binary files /dev/null and b/scripts/__pycache__/hbat1.cpython-36.pyc differ diff --git a/scripts/hbat1.py b/scripts/hbat1.py new file mode 100644 index 0000000000000000000000000000000000000000..aa0ddef6dc2cb244a1162fb7e600211b486ac10a --- /dev/null +++ b/scripts/hbat1.py @@ -0,0 +1,112 @@ +import numpy as np + + +def GetDelay(ser,Start=0x1000): + a=0; + D=[] + Start=0x1000 + while a!=b'': + a=ser.readline()[:8] +# print(a) + if a==b'': break; + a=str(a,'UTF-8') + a=Start-int(a,16) +# print(a) + if (a==0): continue; + D.append(a) + return D; + +def NormDelays(D,offset=19,scale=20): + return [(d+offset)//scale for d in D] #shorter (inbetween) delay = waiting for FIFO + +def Decode(D2): + previous="0"; + res='' + for b in D2[:]: + if b>=6: #Start a new packet + #n=(8-len(res)%8)%8 + n=(len(res)//8)*8 + #res+=n*"0" + res=res[:n] + previous="0" +# print(n,res,previous) + else: + if previous=="0": + bit="0" if b<=2 else "01" + else: + if b==2: bit="1" + elif b==3: bit="0" + else: bit="01" +# print(previous,b,bit) + previous=bit[-1]; + res+=bit; +#print(res) + res=res[2:] +# print("len",len(res)//8) + S=[] + for x in range(len(res)//8): + v1=int(res[x*8:x*8+8],2) +# print(x,res[x*8:x*8+8],v1) + S.append(v1) + return(S) + +CRCtab=np.load("CRC_HBAT1.npy") +CRCtabl=[d%256 for d in CRCtab] +CRCtabh=[d//256 for d in CRCtab] +def CRCcheck(S1): + crcl=0;crch=0; + for b in S1: + i=crcl ^ b + crcl=crch ^ CRCtabl[i] + crch=CRCtabh[i] +# print(i,CRCtabh[i]) +# crch=crcl ^ CRCtabh[i] +# crcl= CRCtabl[i] + return crch*256+crcl + + +def MakeBroadcast(data,func=4,reg=0,serv1=1,serv2=16): + assert(len(data)==32) + data2=[func,reg,serv1,serv2]+data + l=len(data2)+1 + data2=[0,l]+data2 + CRC=CRCcheck(data2) + data2=data2+[CRC%256,CRC//256] + assert(CRCcheck(data2)==0) + return data2 + +def MakeRequest(serv,data=[],func=5,reg=0): + data2=[func,reg]+data + l=len(data2)+1 + data2=[serv,l]+data2 + CRC=CRCcheck(data2) + data2=data2+[CRC%256,CRC//256] + assert(CRCcheck(data2)==0) + return data2 + +#Mlookup=[0x55,0x56,0x59,0x5A,0x65,0x66,0x69,0x6A,0x95,0x96,0x99,0x9A,0xA5,0xA6,0xA9,0xAA] +Mlookup=[0xAA,0x6A,0x9A,0x5A,0xA6,0x66,0x96,0x56,0xA9,0x69,0x99,0x59,0xA5,0x65,0x95,0x55] + +def ManchesterEncode(data): +# Inverted: 0=input=high, 1=output=low. Applied at end. +# Data clocked out MSB first, send on wire LSB first! + data2=[0xff,0x0f,0xa8] #------------_______-_- Start sequence + for d in data: + data2+=[Mlookup[d//16]] + data2+=[Mlookup[d%16]] + data2+=[0xfd] + return [255-d for d in data2] + +def Loopback(TX2): + #Calculte time between edges + S='' + for b in TX2: + S+="{0:08b}".format(255-b)[::-1] + print("Loopback bits:",S[:30]) + T=[0] + for i in range(len(S)-1): + if (S[i]=='1') and (S[i+1]=="0"): T+=[i] + T=np.array(T[1:]) + T=T[1:]-T[:-1] + print("Loopback delay:",T[:30]) + return T \ No newline at end of file diff --git a/scripts/testHBAT2.ipynb b/scripts/testHBAT2.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..f2a7ee7ff2586fddc91aea5d5540d81aca14b792 --- /dev/null +++ b/scripts/testHBAT2.ipynb @@ -0,0 +1,531 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Uses pi pico with l2hbat_pico program" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import serial\n", + "import hbat1 as hb\n", + "from time import sleep" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "Debug=False;" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/dev/ttyACM1\n" + ] + } + ], + "source": [ + "ser = serial.Serial('/dev/ttyACM1',115200,timeout=0.1) # open serial port\n", + "print(ser.name) # check which port was really used" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [], + "source": [ + "def GetPackets():\n", + " D=hb.GetDelay(ser);\n", + " D2=hb.NormDelays(D)\n", + " #print(\"Received delays:\",D2[:10])\n", + " S=hb.Decode(D2)\n", + " RXdata=[]\n", + " #print(\"Received packets:\",S)\n", + " while len(S)>0:\n", + " L=S[1]\n", + " S1=S[:L+3]\n", + " CRC=hb.CRCcheck(S1);\n", + " if Debug: print(\"Received packet:\",S1,\"CRC=\",CRC)\n", + " #if (CRC==0) and (S1[0]>0x80):\n", + " if (S1[0]<=0x10):\n", + " #print(\"Reply from Addr=\",S1[0]-0x80,\" data=\",S[2:-2])\n", + " RXdata=S1[2:-2].copy()\n", + "# print(\"Reply from Addr=\",S1[0],\" data=\",[hex(a) for a in RXdata])\n", + " print(\"Addr=\",S1[0],\" data=\",RXdata)\n", + " S=S[L+3:]\n", + " return RXdata;" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [], + "source": [ + "def SetRegisters(reg,data):\n", + " func=len(data)*2;\n", + " TX1=hb.MakeRequest(HBA_select,data,func,reg);\n", + " if Debug: print(\"Packet to TX\",TX1)\n", + " TX2=hb.ManchesterEncode(TX1)\n", + " ser.write(bytearray(TX2))\n", + " GetPackets();\n", + "def RequestRegisters(reg,length):\n", + " func=length*2+1;\n", + " TX1=hb.MakeRequest(HBA_select,[],func,reg);\n", + " if Debug: print(\"Packet to TX\",TX1)\n", + " TX2=hb.ManchesterEncode(TX1)\n", + " ser.write(bytearray(TX2))\n", + " return GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "def NormDelays2(D,offset=19,scale=20):\n", + " return [(d+offset)/scale for d in D] #shorter (inbetween) delay = waiting for FIFO\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.1\n" + ] + } + ], + "source": [ + "D=[]\n", + "import numpy as np\n", + "while len(D)==0:\n", + " D=hb.GetDelay(ser);\n", + " D2=NormDelays2(D,offset=22)\n", + " D3=[np.abs(d-np.round(d))*(d<5) for d in D2]\n", + " if len(D)>0: \n", + " #print(D3)\n", + " print(np.max(np.array(D3)))" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "ename": "SerialException", + "evalue": "read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mSerialException\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/usr/lib/python3/dist-packages/serial/serialposix.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, size)\u001b[0m\n\u001b[1;32m 500\u001b[0m raise SerialException(\n\u001b[0;32m--> 501\u001b[0;31m \u001b[0;34m'device reports readiness to read but returned no data '\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 502\u001b[0m '(device disconnected or multiple access on port?)')\n", + "\u001b[0;31mSerialException\u001b[0m: device reports readiness to read but returned no data (device disconnected or multiple access on port?)", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mSerialException\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m<ipython-input-27-d7da1479a071>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;31m#while len(S)==0:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mS\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mGetPackets\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;31m#if len(S)==0: continue;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;31m#print(S)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m<ipython-input-26-f2e046a93826>\u001b[0m in \u001b[0;36mGetPackets\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mGetPackets\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mD\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetDelay\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mser\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mD2\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mNormDelays\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mD\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;31m#print(\"Received delays:\",D2[:10])\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mS\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mD2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/home/kruger/git/rcu2hbat/scripts/hbat1.py\u001b[0m in \u001b[0;36mGetDelay\u001b[0;34m(ser, Start)\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mStart\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0x1000\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m!=\u001b[0m\u001b[0;34mb''\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mser\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadline\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;36m8\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 10\u001b[0m \u001b[0;31m# print(a)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m==\u001b[0m\u001b[0;34mb''\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/lib/python3/dist-packages/serial/serialposix.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, size)\u001b[0m\n\u001b[1;32m 507\u001b[0m \u001b[0;31m# https://www.python.org/dev/peps/pep-0475.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 508\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0merrno\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32min\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEAGAIN\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEALREADY\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEWOULDBLOCK\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEINPROGRESS\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEINTR\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 509\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mSerialException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'read failed: {}'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 510\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0merror\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 511\u001b[0m \u001b[0;31m# this is for Python 2.x\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mSerialException\u001b[0m: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)" + ] + } + ], + "source": [ + "S=[]\n", + "#while len(S)==0:\n", + "while True:\n", + " S=GetPackets();\n", + " #if len(S)==0: continue;\n", + " #print(S)" + ] + }, + { + "cell_type": "code", + "execution_count": 303, + "metadata": {}, + "outputs": [], + "source": [ + "#Put LEDS on\n", + "SetRegisters(HBA_PWR,[0x3]);" + ] + }, + { + "cell_type": "code", + "execution_count": 304, + "metadata": {}, + "outputs": [], + "source": [ + "#Put Analog LDO-X on\n", + "#Power Register 0xB: \n", + "#0x01: LED1\n", + "#0x02: LED2\n", + "#0x04: Power X-BF\n", + "#0x08: Power Y-BF\n", + "#0x10: EN-FE power??\n", + "SetRegisters(HBA_PWR,[0x04]);" + ] + }, + { + "cell_type": "code", + "execution_count": 305, + "metadata": {}, + "outputs": [], + "source": [ + "#Antenna power\n", + "#Enable FE LDOs\n", + "SetRegisters(HBA_PWR,[0x14]);" + ] + }, + { + "cell_type": "code", + "execution_count": 306, + "metadata": {}, + "outputs": [], + "source": [ + "#Enable all FE\n", + "SetRegisters(HBA_FE_PWR,[0x0F]);" + ] + }, + { + "cell_type": "code", + "execution_count": 307, + "metadata": {}, + "outputs": [], + "source": [ + "#Set output switch = G1\n", + "#Output switch: 0=G1, 2=G4, 1(4)=G3, 6(3)=All, 4(1)=G2 (Bits swapped!)\n", + "SetRegisters(HBA_SWX,[4]);" + ] + }, + { + "cell_type": "code", + "execution_count": 308, + "metadata": {}, + "outputs": [], + "source": [ + "#Set output switch = BF, BFon\n", + "#BF (8) =on\n", + "SetRegisters(HBA_SWX,[8+6]);" + ] + }, + { + "cell_type": "code", + "execution_count": 309, + "metadata": {}, + "outputs": [], + "source": [ + "SetRegisters(HBA_X,[0xF0]*4);" + ] + }, + { + "cell_type": "code", + "execution_count": 310, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0xf0', '0xf0']\n" + ] + } + ], + "source": [ + "RequestRegisters(1,2);" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 3, 21, 0, 254, 232]\n", + "Received packet: [2, 3, 21, 0, 254, 232] CRC= 0\n", + "Received packet: [130, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 93] CRC= 0\n", + "Reply from Addr= 2 data= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n" + ] + } + ], + "source": [ + "#Request all the uC settings:\n", + "RequestRegisters(0,0xA);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 144, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [3, 3, 27, 16, 251, 120]\n", + "Received packet: [3, 3, 27, 16, 251, 120] CRC= 0\n" + ] + } + ], + "source": [ + "#Request all the uC settings:\n", + "RequestRegisters(0x10,0xD);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "ser.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 4, 2, 11, 3, 159, 193]\n", + "Received packet: [2, 4, 2, 11, 3, 159, 193] CRC= 0\n" + ] + } + ], + "source": [ + "SetRegisters(0xB,[3]);#LEDS on\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 150, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 3, 37, 16, 234, 228]\n", + "Received packet: [2, 3, 37, 16, 234, 228] CRC= 0\n", + "Received packet: [130, 19, 0, 117, 77, 74, 255, 2, 125, 175, 88, 0, 0, 4, 0, 80, 0, 2, 3, 4, 47, 48] CRC= 0\n", + "Reply from Addr= 2 data= [0, 117, 77, 74, 255, 2, 125, 175, 88, 0, 0, 4, 0, 80, 0, 2, 3, 4]\n" + ] + } + ], + "source": [ + "#Request registers\n", + "RequestRegisters(0x10,18);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 212, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [15, 3, 9, 16, 245, 72]\n", + "Received packet: [15, 3, 9, 16, 245, 72] CRC= 0\n" + ] + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 236, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x3']\n" + ] + } + ], + "source": [ + "def SetAddress(HBA_select_new):\n", + " global HBA_select;\n", + " SetRegisters(HBA_ADDR,[HBA_select_new]);#Change address\n", + " HBA_select=HBA_select_new\n", + " GetPackets();\n", + " RequestRegisters(HBA_ADDR,1);\n", + " GetPackets();\n", + "SetAddress(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 147, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 5, 4, 32, 3, 4, 205, 235]\n", + "Received packet: [2, 5, 4, 32, 3, 4, 205, 235] CRC= 0\n", + "Packet to TX [2, 3, 5, 32, 243, 48]\n", + "Received packet: [2, 3, 5, 32, 243, 48] CRC= 0\n", + "Received packet: [130, 3, 3, 4, 217, 75] CRC= 0\n", + "Reply from Addr= 2 data= [3, 4]\n" + ] + } + ], + "source": [ + "SetRegisters(0x20,[3,4]);#test - not used\n", + "GetPackets();\n", + "RequestRegisters(0x20,2);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 237, + "metadata": {}, + "outputs": [], + "source": [ + "RequestRegisters(HBA_SAVE_EEPROM,1);" + ] + }, + { + "cell_type": "code", + "execution_count": 267, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x0', '0x75', '0x4d', '0x4a', '0xf2', '0x94', '0x90', '0xf2']\n", + "Reply from Addr= 3 data= ['0x3', '0x0', '0x7d', '0x2', '0x7d', '0xaf', '0x58', '0x0', '0x0', '0x4', '0x0', '0x50']\n" + ] + } + ], + "source": [ + "SetRegisters(HBA_LOAD_EEPROM,[])\n", + "#Request registers\n", + "RequestRegisters(0x10,8);\n", + "RequestRegisters(0x20,12);" + ] + }, + { + "cell_type": "code", + "execution_count": 268, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x0', '0x75', '0x4d', '0x4a', '0xf2', '0x94', '0x90', '0xf2']\n", + "Reply from Addr= 3 data= ['0x3', '0x0', '0x7d', '0x2', '0x7d', '0xaf', '0x58', '0x0', '0x0', '0x4', '0x0', '0x50']\n" + ] + } + ], + "source": [ + "#Request registers\n", + "RequestRegisters(0x10,8);\n", + "RequestRegisters(0x20,12);" + ] + }, + { + "cell_type": "code", + "execution_count": 311, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x2', '0x4c']\n", + "scale= 0.01219482421875\n", + "Vsense= 7.170556640625\n" + ] + } + ], + "source": [ + "V=RequestRegisters(HBA_VSENSE,1);\n", + "V1=V[0]*256+V[1]\n", + "Vref=3.33\n", + "R1=1.2 #kOhm\n", + "R2=3.3 #kOhm\n", + "Div=R1/(R1+R2)\n", + "print('scale=',1/(2**10)*Vref/Div)\n", + "V1=V1/(2**10)*Vref/Div\n", + "print(\"Vsense=\",V1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/scripts/testHBAT2b.ipynb b/scripts/testHBAT2b.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..b9e5efb63731b40ac97649dfcf28168581ba1569 --- /dev/null +++ b/scripts/testHBAT2b.ipynb @@ -0,0 +1,555 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Uses pi pico with l2hbat_pico program" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import serial\n", + "import hbat1 as hb\n", + "from time import sleep" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "Debug=True;" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/dev/ttyACM2\n" + ] + } + ], + "source": [ + "ser = serial.Serial('/dev/ttyACM2',115200,timeout=0.1) # open serial port\n", + "print(ser.name) # check which port was really used" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "ename": "SerialException", + "evalue": "read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mSerialException\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/usr/lib/python3/dist-packages/serial/serialposix.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, size)\u001b[0m\n\u001b[1;32m 500\u001b[0m raise SerialException(\n\u001b[0;32m--> 501\u001b[0;31m \u001b[0;34m'device reports readiness to read but returned no data '\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 502\u001b[0m '(device disconnected or multiple access on port?)')\n", + "\u001b[0;31mSerialException\u001b[0m: device reports readiness to read but returned no data (device disconnected or multiple access on port?)", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mSerialException\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m<ipython-input-9-eccd2f46a9ae>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mser\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadline\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;31m#[:8]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m!=\u001b[0m\u001b[0;34mb''\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/lib/python3/dist-packages/serial/serialposix.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, size)\u001b[0m\n\u001b[1;32m 507\u001b[0m \u001b[0;31m# https://www.python.org/dev/peps/pep-0475.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 508\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0merrno\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32min\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEAGAIN\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEALREADY\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEWOULDBLOCK\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEINPROGRESS\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrno\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEINTR\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 509\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mSerialException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'read failed: {}'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 510\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0merror\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 511\u001b[0m \u001b[0;31m# this is for Python 2.x\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mSerialException\u001b[0m: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)" + ] + } + ], + "source": [ + "while True:\n", + " a=ser.readline()#[:8]\n", + " if (a!=b''): print(a)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [], + "source": [ + "def GetPackets():\n", + " D=hb.GetDelay(ser);\n", + " D2=hb.NormDelays(D)\n", + " #print(\"Received delays:\",D2[:10])\n", + " S=hb.Decode(D2)\n", + " RXdata=[]\n", + " #print(\"Received packets:\",S)\n", + " while len(S)>0:\n", + " L=S[1]\n", + " S1=S[:L+3]\n", + " CRC=hb.CRCcheck(S1);\n", + " if Debug: print(\"Received packet:\",S1,\"CRC=\",CRC)\n", + " #if (CRC==0) and (S1[0]>0x80):\n", + " if (S1[0]<=0x10):\n", + " #print(\"Reply from Addr=\",S1[0]-0x80,\" data=\",S[2:-2])\n", + " RXdata=S1[2:-2].copy()\n", + "# print(\"Reply from Addr=\",S1[0],\" data=\",[hex(a) for a in RXdata])\n", + " print(\"Addr=\",S1[0],\" data=\",RXdata)\n", + " S=S[L+3:]\n", + " return RXdata;" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "def SetRegisters(reg,data):\n", + " func=len(data)*2;\n", + " TX1=hb.MakeRequest(HBA_select,data,func,reg);\n", + " if Debug: print(\"Packet to TX\",TX1)\n", + " TX2=hb.ManchesterEncode(TX1)\n", + " ser.write(bytearray(TX2))\n", + " GetPackets();\n", + "def RequestRegisters(reg,length):\n", + " func=length*2+1;\n", + " TX1=hb.MakeRequest(HBA_select,[],func,reg);\n", + " if Debug: print(\"Packet to TX\",TX1)\n", + " TX2=hb.ManchesterEncode(TX1)\n", + " ser.write(bytearray(TX2))\n", + " return GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "def NormDelays2(D,offset=19,scale=20):\n", + " return [(d+offset)/scale for d in D] #shorter (inbetween) delay = waiting for FIFO\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.1\n" + ] + } + ], + "source": [ + "D=[]\n", + "import numpy as np\n", + "while len(D)==0:\n", + " D=hb.GetDelay(ser);\n", + " D2=NormDelays2(D,offset=22)\n", + " D3=[np.abs(d-np.round(d))*(d<5) for d in D2]\n", + " if len(D)>0: \n", + " #print(D3)\n", + " print(np.max(np.array(D3)))" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m<ipython-input-16-d7da1479a071>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;31m#while len(S)==0:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mS\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mGetPackets\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;31m#if len(S)==0: continue;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;31m#print(S)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m<ipython-input-14-f2e046a93826>\u001b[0m in \u001b[0;36mGetPackets\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mGetPackets\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mD\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetDelay\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mser\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mD2\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mNormDelays\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mD\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;31m#print(\"Received delays:\",D2[:10])\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mS\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mD2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/home/kruger/git/rcu2hbat/scripts/hbat1.py\u001b[0m in \u001b[0;36mGetDelay\u001b[0;34m(ser, Start)\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mStart\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0x1000\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m!=\u001b[0m\u001b[0;34mb''\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mser\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadline\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;36m8\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 10\u001b[0m \u001b[0;31m# print(a)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m==\u001b[0m\u001b[0;34mb''\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/lib/python3/dist-packages/serial/serialposix.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, size)\u001b[0m\n\u001b[1;32m 481\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0msize\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 482\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 483\u001b[0;31m \u001b[0mready\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfd\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpipe_abort_read_r\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtime_left\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 484\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpipe_abort_read_r\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mready\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpipe_abort_read_r\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1000\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], + "source": [ + "S=[]\n", + "#while len(S)==0:\n", + "while True:\n", + " S=GetPackets();\n", + " #if len(S)==0: continue;\n", + " #print(S)" + ] + }, + { + "cell_type": "code", + "execution_count": 303, + "metadata": {}, + "outputs": [], + "source": [ + "#Put LEDS on\n", + "SetRegisters(HBA_PWR,[0x3]);" + ] + }, + { + "cell_type": "code", + "execution_count": 304, + "metadata": {}, + "outputs": [], + "source": [ + "#Put Analog LDO-X on\n", + "#Power Register 0xB: \n", + "#0x01: LED1\n", + "#0x02: LED2\n", + "#0x04: Power X-BF\n", + "#0x08: Power Y-BF\n", + "#0x10: EN-FE power??\n", + "SetRegisters(HBA_PWR,[0x04]);" + ] + }, + { + "cell_type": "code", + "execution_count": 305, + "metadata": {}, + "outputs": [], + "source": [ + "#Antenna power\n", + "#Enable FE LDOs\n", + "SetRegisters(HBA_PWR,[0x14]);" + ] + }, + { + "cell_type": "code", + "execution_count": 306, + "metadata": {}, + "outputs": [], + "source": [ + "#Enable all FE\n", + "SetRegisters(HBA_FE_PWR,[0x0F]);" + ] + }, + { + "cell_type": "code", + "execution_count": 307, + "metadata": {}, + "outputs": [], + "source": [ + "#Set output switch = G1\n", + "#Output switch: 0=G1, 2=G4, 1(4)=G3, 6(3)=All, 4(1)=G2 (Bits swapped!)\n", + "SetRegisters(HBA_SWX,[4]);" + ] + }, + { + "cell_type": "code", + "execution_count": 308, + "metadata": {}, + "outputs": [], + "source": [ + "#Set output switch = BF, BFon\n", + "#BF (8) =on\n", + "SetRegisters(HBA_SWX,[8+6]);" + ] + }, + { + "cell_type": "code", + "execution_count": 309, + "metadata": {}, + "outputs": [], + "source": [ + "SetRegisters(HBA_X,[0xF0]*4);" + ] + }, + { + "cell_type": "code", + "execution_count": 310, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0xf0', '0xf0']\n" + ] + } + ], + "source": [ + "RequestRegisters(1,2);" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 3, 21, 0, 254, 232]\n", + "Received packet: [2, 3, 21, 0, 254, 232] CRC= 0\n", + "Received packet: [130, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 93] CRC= 0\n", + "Reply from Addr= 2 data= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n" + ] + } + ], + "source": [ + "#Request all the uC settings:\n", + "RequestRegisters(0,0xA);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 144, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [3, 3, 27, 16, 251, 120]\n", + "Received packet: [3, 3, 27, 16, 251, 120] CRC= 0\n" + ] + } + ], + "source": [ + "#Request all the uC settings:\n", + "RequestRegisters(0x10,0xD);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "ser.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 4, 2, 11, 3, 159, 193]\n", + "Received packet: [2, 4, 2, 11, 3, 159, 193] CRC= 0\n" + ] + } + ], + "source": [ + "SetRegisters(0xB,[3]);#LEDS on\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 150, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 3, 37, 16, 234, 228]\n", + "Received packet: [2, 3, 37, 16, 234, 228] CRC= 0\n", + "Received packet: [130, 19, 0, 117, 77, 74, 255, 2, 125, 175, 88, 0, 0, 4, 0, 80, 0, 2, 3, 4, 47, 48] CRC= 0\n", + "Reply from Addr= 2 data= [0, 117, 77, 74, 255, 2, 125, 175, 88, 0, 0, 4, 0, 80, 0, 2, 3, 4]\n" + ] + } + ], + "source": [ + "#Request registers\n", + "RequestRegisters(0x10,18);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 212, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [15, 3, 9, 16, 245, 72]\n", + "Received packet: [15, 3, 9, 16, 245, 72] CRC= 0\n" + ] + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 236, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x3']\n" + ] + } + ], + "source": [ + "def SetAddress(HBA_select_new):\n", + " global HBA_select;\n", + " SetRegisters(HBA_ADDR,[HBA_select_new]);#Change address\n", + " HBA_select=HBA_select_new\n", + " GetPackets();\n", + " RequestRegisters(HBA_ADDR,1);\n", + " GetPackets();\n", + "SetAddress(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 147, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Packet to TX [2, 5, 4, 32, 3, 4, 205, 235]\n", + "Received packet: [2, 5, 4, 32, 3, 4, 205, 235] CRC= 0\n", + "Packet to TX [2, 3, 5, 32, 243, 48]\n", + "Received packet: [2, 3, 5, 32, 243, 48] CRC= 0\n", + "Received packet: [130, 3, 3, 4, 217, 75] CRC= 0\n", + "Reply from Addr= 2 data= [3, 4]\n" + ] + } + ], + "source": [ + "SetRegisters(0x20,[3,4]);#test - not used\n", + "GetPackets();\n", + "RequestRegisters(0x20,2);\n", + "GetPackets();" + ] + }, + { + "cell_type": "code", + "execution_count": 237, + "metadata": {}, + "outputs": [], + "source": [ + "RequestRegisters(HBA_SAVE_EEPROM,1);" + ] + }, + { + "cell_type": "code", + "execution_count": 267, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x0', '0x75', '0x4d', '0x4a', '0xf2', '0x94', '0x90', '0xf2']\n", + "Reply from Addr= 3 data= ['0x3', '0x0', '0x7d', '0x2', '0x7d', '0xaf', '0x58', '0x0', '0x0', '0x4', '0x0', '0x50']\n" + ] + } + ], + "source": [ + "SetRegisters(HBA_LOAD_EEPROM,[])\n", + "#Request registers\n", + "RequestRegisters(0x10,8);\n", + "RequestRegisters(0x20,12);" + ] + }, + { + "cell_type": "code", + "execution_count": 268, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x0', '0x75', '0x4d', '0x4a', '0xf2', '0x94', '0x90', '0xf2']\n", + "Reply from Addr= 3 data= ['0x3', '0x0', '0x7d', '0x2', '0x7d', '0xaf', '0x58', '0x0', '0x0', '0x4', '0x0', '0x50']\n" + ] + } + ], + "source": [ + "#Request registers\n", + "RequestRegisters(0x10,8);\n", + "RequestRegisters(0x20,12);" + ] + }, + { + "cell_type": "code", + "execution_count": 311, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reply from Addr= 3 data= ['0x2', '0x4c']\n", + "scale= 0.01219482421875\n", + "Vsense= 7.170556640625\n" + ] + } + ], + "source": [ + "V=RequestRegisters(HBA_VSENSE,1);\n", + "V1=V[0]*256+V[1]\n", + "Vref=3.33\n", + "R1=1.2 #kOhm\n", + "R2=3.3 #kOhm\n", + "Div=R1/(R1+R2)\n", + "print('scale=',1/(2**10)*Vref/Div)\n", + "V1=V1/(2**10)*Vref/Div\n", + "print(\"Vsense=\",V1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/src/HBA1.h b/src/HBA1.h index 91413bfa226642a26e95720d6aec651bf3df7faf..d588eb172dec458bd061ea2dfb3362a9cb146b56 100644 --- a/src/HBA1.h +++ b/src/HBA1.h @@ -8,8 +8,11 @@ bool HBA_(I2CReg_to_request)(uint8_t I2C_length,uint8_t* Buffer); //Mode 2: I2C read bool HBA_(I2CReg_to_packet)(uint8_t I2C_length,uint8_t* Buffer); //Mode 2: I2C write -uint8_t HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* I2C_Buffer); +uint8_t* HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* length); +//uint8_t HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* I2C_Buffer); void HBA_(I2CReg_decode_responce)(); bool HBA_(I2CReg_waiting)(); +bool HBA_(send_signal)(); + #undef HBA_ #endif // HBA1_TX_H diff --git a/src/HBA2.h b/src/HBA2.h index 3e574419d0debe63ccde39e3b0caea1adbad550c..1dd977d666611c23904772de2dec0a7924cecdd9 100644 --- a/src/HBA2.h +++ b/src/HBA2.h @@ -8,9 +8,12 @@ bool HBA_(I2CReg_to_request)(uint8_t I2C_length,uint8_t* Buffer); //Mode 2: I2C read bool HBA_(I2CReg_to_packet)(uint8_t I2C_length,uint8_t* Buffer); //Mode 2: I2C write -uint8_t HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* I2C_Buffer); +//uint8_t HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* I2C_Buffer); +uint8_t* HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* length); void HBA_(I2CReg_decode_responce)(); bool HBA_(I2CReg_waiting)(); +bool HBA_(send_signal)(); + #undef HBA_ #endif // HBA1_TX_H diff --git a/src/HBA3.h b/src/HBA3.h index 4b16fea53b3c888ef7285d4dd824e170dfb9a07c..44b39a911f30600ac1161618a7b2bb71f4c9cbfc 100644 --- a/src/HBA3.h +++ b/src/HBA3.h @@ -8,8 +8,11 @@ bool HBA_(I2CReg_to_request)(uint8_t I2C_length,uint8_t* Buffer); //Mode 2: I2C read bool HBA_(I2CReg_to_packet)(uint8_t I2C_length,uint8_t* Buffer); //Mode 2: I2C write -uint8_t HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* I2C_Buffer); +//uint8_t HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* I2C_Buffer); +uint8_t* HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* length); void HBA_(I2CReg_decode_responce)(); bool HBA_(I2CReg_waiting)(); +bool HBA_(send_signal)(); + #endif // HBA1_TX_H #undef HBA_ diff --git a/src/HBAx.c b/src/HBAx.c index 6eafcd6b75daaeff6606d3d118d9940f1c208552..826e466b4b3eb4a2288fc43a4669320c2475cdf3 100644 --- a/src/HBAx.c +++ b/src/HBAx.c @@ -15,6 +15,7 @@ uint8_t HBA_(reqpacket)[HBAreqlen]={0x1, 0x3, 0x5, 0x0}; //Server number, length=3, get word=5, register=0 uint8_t HBA_(req_adr)=0; +bool HBA_(read_to_tx)=false; bool HBA_(I2CReg_to_request)(uint8_t I2C_length,uint8_t* Buffer) //Mode 2: I2C read { @@ -38,6 +39,10 @@ bool HBA_(I2CReg_to_packet)(uint8_t I2C_length,uint8_t* Buffer) //Mode 2: I2C w if (adr+I2C_length==HBAXYlen) //When the last one is written -> send to HBA { HBA_(Make_packet)(HBAXYlen,HBA_XYpacket); + if (Get_waitPPS()) { + HBA_(read_to_tx)=true; + return false; + } if (Get_autoread()) HBA_req_adr=1; return true; } @@ -45,19 +50,22 @@ bool HBA_(I2CReg_to_packet)(uint8_t I2C_length,uint8_t* Buffer) //Mode 2: I2C w return false; } -uint8_t HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* I2C_Buffer) +//uint8_t HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* I2C_Buffer) +uint8_t* HBA_(I2CReg_get_buffer)(uint8_t HBARegister,uint8_t* length) { - uint8_t x=0; +// uint8_t x=0; //HBARegister=0x10; //if ((HBARegister>=0x10) && (HBARegister<=0x2F)) //{ // for (;HBARegister<0x30;HBARegister++) // I2C_Buffer[x++]=HBA_XYpacket[HBARegister-0x10+6]; //} - I2C_Buffer[0]=HBA_XYpacket[6]; - for (x=0;x<32;x++) - I2C_Buffer[x+1]=HBA_XYpacket[x+6]; - return 32+1; + *length=32+1; + return &HBA_XYpacket[6]; +// I2C_Buffer[0]=HBA_XYpacket[6]; +// for (x=0;x<32;x++) +// I2C_Buffer[x+1]=HBA_XYpacket[x+6]; +// return 32+1; } void HBA_(I2CReg_decode_responce)() @@ -77,9 +85,17 @@ void HBA_(I2CReg_decode_responce)() } } } +bool HBA_(send_signal)() +{ + if (HBA_(read_to_tx)) { + HBA_req_adr=1; + return true; + } + return false; +} bool HBA_(I2CReg_waiting)() -{ +{ HBA_(read_to_tx)=false; if (HBA_req_adr>16) HBA_req_adr=0; if (HBA_req_adr>0) { HBA_reqpacket[0]=HBA_req_adr; //start at 1, request X and Y together diff --git a/src/HBAx_i2c.c b/src/HBAx_i2c.c index fce01ded1c852afd6a1c9d9308ec99c0da70ec9b..23fe5521b224cd6bd3a5de115d6520b84420aad0 100644 --- a/src/HBAx_i2c.c +++ b/src/HBAx_i2c.c @@ -27,16 +27,19 @@ void HBA_(I2C_RX)(){ } } -uint8_t HBA_(I2C_TX)(){ - int x; +uint8_t* HBA_(I2C_TX)(uint8_t* length){ +//int x; if (HBA_RX_Mode()<=1) { - for (x=0;x<HBA_(RX2_length)();x++) {I2C_Buffer()[x]=HBA_(RX2_Buffer)()[x];} - I2C_Buffer()[0]=HBA_(RX2_length)(); - return HBA_(RX2_length)(); +// for (x=0;x<HBA_(RX2_length)();x++) {I2C_Buffer()[x]=HBA_(RX2_Buffer)()[x];} +// I2C_Buffer()[0]=HBA_(RX2_length)(); + *length=HBA_(RX2_length)(); + return HBA_(RX2_Buffer)(); } -else if (HBA_RX_Mode()==2) - return HBA_(I2CReg_get_buffer)(HBARegister,I2C_Buffer()); +else if (HBA_RX_Mode()==2) { + return HBA_(I2CReg_get_buffer)(HBARegister,length); +} +*length=0; return 0; } diff --git a/src/rcu2_i2c.c b/src/rcu2_i2c.c index 77b4e4e9b2a451ce26fd799b4de93530e06b57e5..7e57f67c0e64df822d6d060ee965192e6d709d1f 100644 --- a/src/rcu2_i2c.c +++ b/src/rcu2_i2c.c @@ -1,4 +1,5 @@ #include "rcu2_i2c.h" +#include "registers.h" #include "../mcc_generated_files/i2c1.h" #include "HBA1_RX.h" @@ -13,25 +14,49 @@ #include "HBA3_TX.h" #include "HBA3.h" -#include "registers.h" uint8_t PicRegister=0; + +#define I2C_BUFF_SIZE 64 +uint8_t I2C_rx_length,I2C_tx_length; +uint8_t I2C_address; +uint8_t I2C_data[I2C_BUFF_SIZE]; +uint8_t *I2C_tx_data; + +inline uint8_t* I2C_Buffer(void) {return I2C_data;} +inline uint8_t I2C_Buffer_Length(void) {return I2C_rx_length;} +inline uint8_t I2C_Address(void) {return I2C_address;} + +bool i2c_busy_rx = false; +bool i2c_busy_tx = false; +uint8_t i2c_cnt; +//uint8_t I2CRXbyte = 0xAA: + + void I2C_RX_pic(){ - if (I2C_Buffer_Length()==0) return; - PicRegister=I2C_Buffer()[0]; - if (I2C_Buffer_Length()==1) return; - if (PicRegister>=RegisterCount) return; - SetRegister(PicRegister,I2C_Buffer()[1]); + uint8_t x; + if (I2C_rx_length==0) return; + PicRegister=I2C_data[0]; + if (PicRegister==PPS_REGISTER) { + if (HBA1_send_signal()) HBA1_start_TX(); + if (HBA2_send_signal()) HBA2_start_TX(); + if (HBA2_send_signal()) HBA3_start_TX(); + return; + } + for (x=1;x<I2C_rx_length;x++) { + if (PicRegister>=RegisterCount) return; + SetRegister(PicRegister++,I2C_data[x]); + } } -uint8_t I2C_TX_pic(){ - if (PicRegister>=RegisterCount) return 0; - I2C_Buffer()[0]= GetRegister(PicRegister); -// I2C_Buffer()[0]=HBA_RX_length(); -// I2C_Buffer()[1]=HBA_TX_length(); -// I2C_Buffer()[2]=I2C_Address(); - return 1; +uint8_t* I2C_TX_pic(uint8_t *length){ + if (PicRegister>=RegisterCount) PicRegister=RegisterCount-1; + *length=RegisterCount-PicRegister; + return &(registers()->Buffer[PicRegister]); +//// I2C_Buffer()[0]=HBA_RX_length(); +//// I2C_Buffer()[1]=HBA_TX_length(); +//// I2C_Buffer()[2]=I2C_Address(); } #define HBA_(name) HBA1_ ## name @@ -47,16 +72,6 @@ uint8_t I2C_TX_pic(){ #undef HBA_ -uint8_t I2C_TX_request(){ - switch (I2C_Address()) - { - case 0x40: return I2C_TX_pic(); - case 0x41: return HBA1_I2C_TX(); - case 0x42: return HBA2_I2C_TX(); - case 0x43: return HBA3_I2C_TX(); - } - return 0; -} void I2C_packet(){ switch (I2C_Address()) @@ -68,3 +83,61 @@ void I2C_packet(){ } } +bool I2C_busy() { + if (i2c_busy_tx) return true; + if (!i2c_busy_rx) return false; + if (I2C1STATbits.P==1) I2C_done_RX(); + return i2c_busy_rx; +} + +void I2C_start_RX(uint8_t I2C_Address){ + I2C_address=I2C_Address>>1; + I2C_rx_length=0; + i2c_busy_rx=true; +} + +void I2C_RX_byte(uint8_t data){ + I2C_data[I2C_rx_length++]=data; + if(I2C_rx_length >= I2C_BUFF_SIZE) I2C_rx_length = I2C_BUFF_SIZE; +} + +void I2C_done_RX(){ + i2c_busy_rx=false; + I2C_packet(); +} + +uint8_t I2C_start_TX(uint8_t I2C_Address){ + if (i2c_busy_rx) I2C_done_RX(); + I2C_address=I2C_Address>>1; + switch (I2C_address) + { + case 0x40: + I2C_tx_data=I2C_TX_pic(&I2C_tx_length); + break; + case 0x41: + I2C_tx_data=HBA1_I2C_TX(&I2C_tx_length); + break; + case 0x42: + I2C_tx_data=HBA2_I2C_TX(&I2C_tx_length); + break; + case 0x43: + I2C_tx_data=HBA3_I2C_TX(&I2C_tx_length); + break; + } + i2c_cnt=0; + i2c_busy_tx=true; + return I2C_TX_byte(); +} + +uint8_t I2C_TX_byte(){ + if (i2c_cnt >= I2C_tx_length-1) i2c_cnt = I2C_tx_length-1; +// return I2C_address; + +// return I2C_data[0]; + return I2C_tx_data[i2c_cnt++]; +} + +void I2C_done_TX(){ + i2c_busy_tx=false; +} + diff --git a/src/rcu2_i2c.h b/src/rcu2_i2c.h index 3692c8697af94c6e4770be41f90d7584c8e1c3db..c3bde3a882da07b438dd07a720abc394bb0842c8 100644 --- a/src/rcu2_i2c.h +++ b/src/rcu2_i2c.h @@ -2,8 +2,21 @@ #define RCU2_I2C__H #include <xc.h> +#include "../mcc_generated_files/i2c1.h" uint8_t I2C_TX_request(); void I2C_packet(); +bool I2C_busy(); //polled in main loop. + +//Functions called by I2C driver +void I2C_start_RX(uint8_t I2C_Address); +void I2C_RX_byte(uint8_t data); +void I2C_done_RX(); + +uint8_t I2C_start_TX(uint8_t I2C_Address); +uint8_t I2C_TX_byte(); +void I2C_done_TX(); + + #endif // RCU2_I2C__H diff --git a/src/registers.c b/src/registers.c index 256158751d6c02778df4628bf131f695e5b2dcf0..6b247f793b95f3d072414273941b4e0eac2f5518 100644 --- a/src/registers.c +++ b/src/registers.c @@ -3,6 +3,8 @@ union Regs Regs; +union Regs* registers() {return &Regs;} + inline void SetRegister(uint8_t Addr,uint8_t value) { @@ -25,6 +27,7 @@ void Set_RX_Timeout(uint16_t value){Regs.R.HBA_RX_Timeout=value;} inline uint16_t Get_TXRX_Timeout(void){return Regs.R.HBA_TXRX_Timeout;} void Set_TXRX_Timeout(uint16_t value){Regs.R.HBA_TXRX_Timeout=value;} inline bool Get_autoread(void) {return Regs.R.autoreadback;} +inline bool Get_waitPPS(void) {return Regs.R.waitPPS;} @@ -37,6 +40,7 @@ void Register_defaults(void) Regs.R.HBA_RX_Timeout=0x0400; Regs.R.HBA_TXRX_Timeout=0x5000; Regs.R.autoreadback=1; + Regs.R.waitPPS=0; } diff --git a/src/registers.h b/src/registers.h index 4d9fb4b1a0ab22fb38ea70e292ee4e377d6a27d6..f87dee9b8d8a1285f8764b2851bf150c7ee2a619 100644 --- a/src/registers.h +++ b/src/registers.h @@ -12,16 +12,19 @@ struct Registers { uint8_t HBA_speed2; //4 uint8_t autoreadback; //5 uint16 start on even uint16_t HBA_TX_speed; //6,7 order low,high - uint16_t HBA_RX_Timeout;//8,9 - uint16_t HBA_TXRX_Timeout;//10,11 + uint16_t HBA_RX_Timeout;//8,9 //Timeout to determine end of packed + uint16_t HBA_TXRX_Timeout;//10,11 //Timeout waiting for reply from tile + uint16_t waitPPS; //12 + uint8_t extra[3];//13,14,15 + uint8_t version[4]; //0x10 }; -#define RegisterCount 12 - +#define RegisterCount 0x14 +#define PPS_REGISTER 0xff union Regs { struct Registers R; uint8_t Buffer[RegisterCount]; }; - +union Regs* registers(); void Register_defaults(void); void SetRegister(uint8_t Addr,uint8_t value); @@ -40,7 +43,7 @@ bool Get_autoread(void); uint8_t HBA_RX_Mode(void); void Set_RX_Timeout(uint16_t value); void Set_TXRX_Timeout(uint16_t value); - +bool Get_waitPPS(); #endif