Ver Fonte

recent updates for testing ADC read for MSPM0L1304

namrota ghosh há 8 meses atrás
pai
commit
608d3c3d27
4 ficheiros alterados com 15 adições e 10 exclusões
  1. BIN
      .controller_target.syscfg.swp
  2. 2 1
      .cproject
  3. 4 1
      src/peripherals/adc/adc_hal.c
  4. 9 8
      src/target_main.c

BIN
.controller_target.syscfg.swp


+ 2 - 1
.cproject

@@ -74,7 +74,8 @@
                                 <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP.1785462721" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
                                 <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DISPLAY_ERROR_NUMBER.175695452" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
                                 <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.XML_LINK_INFO.1359937870" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.XML_LINK_INFO" value="${ProjName}_linkInfo.xml" valueType="string"/>
-                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.HEAP_SIZE.754278704" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.HEAP_SIZE" value="0x100" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.HEAP_SIZE.754278704" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.HEAP_SIZE" value="0x200" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.STACK_SIZE.758072631" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.STACK_SIZE" value="0x100" valueType="string"/>
                             </tool>
                             <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.hex.760139285" name="Arm Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.hex"/>
                             <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy.1014521351" name="Arm Objcopy Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy"/>

+ 4 - 1
src/peripherals/adc/adc_hal.c

@@ -117,7 +117,10 @@ static bool adc_configure(uint8_t slot_id, ADC_Params params) {
   while (DL_I2C_getControllerStatus(I2C_controller_INST) &
          DL_I2C_CONTROLLER_STATUS_BUSY_BUS)
     ;
-  if(config_byte == 0xFF) return false;
+  if(config_byte == 0xFF){
+    printf("[ADC] Unable to send config bytes\n");
+    return false;
+  } 
   // Prepare TX Buffer:
   gTxPacket[0] = config_byte;
   gTxADClen = 1;

+ 9 - 8
src/target_main.c

@@ -4,8 +4,8 @@
 #include "ti_msp_dl_config.h"
 #include <stdint.h>
 #include <stdio.h>
-#include <string.h>
-#include <ti/drivers/GPIO.h>
+
+
 //adc peripheral
 #include "src/peripherals/adc/adc.h"
 #include "src/peripherals/adc/adc_interface.h"
@@ -105,7 +105,7 @@ void I2C_controller_INST_IRQHandler(void) {
     // printf("Interrupt index for I2C controller Arbitration Lost!\n");
     break;
   case DL_I2C_IIDX_CONTROLLER_NACK:
-    // printf("I2C NACK Received\n");
+    printf("I2C NACK Received\n");
     if ((gI2C.status == I2C_STATUS_RX_STARTED) ||
         (gI2C.status = I2C_STATUS_TX_STARTED)) {
       gI2C.status = I2C_STATUS_ERROR;
@@ -152,21 +152,22 @@ void I2C_target_INST_IRQHandler(void) {
 
 int main(void){
     SYSCFG_DL_init();
-    Battery_Init();
+    //Battery_Init();
     // Reset_I2C_Bus();
     NVIC_EnableIRQ(I2C_target_INST_INT_IRQN);
     NVIC_EnableIRQ(I2C_controller_INST_INT_IRQN);
-    printf("*******Scanning the peripherals********\n");
+    //fflush(stdout);
     //I2C Scanning
-    I2C_scanBus(I2C_controller_INST);
+    printf("Testing I2C\n");
+    //I2C_scanBus(I2C_controller_INST);
     I2C_init(&gI2C);
 
     while(1){
-        if(mcuCommandPending){
+        /*if(mcuCommandPending){
             mcu_i2c_handle(I2C_target_INST);
             mcuCommandPending= false;
             continue;
-        }
+        }*/
         // Looping through the ADC Channels
         for (uint8_t slot_id = 0; slot_id < NUM_SLOTS; slot_id++) {
             for (uint8_t adc_channel = 0; adc_channel < ADC_CHANNEL_NUM; adc_channel++) {