Closed fabricedesre closed 7 years ago
I'll hook up my logic analyzer tomorrow and do a capture and see what it says.
You're missing the pin initialization:
diff --git a/cc3200-sys/board.c b/cc3200-sys/board.c
index 6ee8d24..b8e344f 100644
--- a/cc3200-sys/board.c
+++ b/cc3200-sys/board.c
@@ -105,6 +105,7 @@ void board_init(void) {
//
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
+ MAP_PRCMPeripheralClkEnable(PRCM_I2CA0, PRCM_RUN_MODE_CLK);
//
// Configure PIN_64 (GPIO9) for GPIOOutput - RED LED
@@ -133,6 +134,16 @@ void board_init(void) {
// Configure PIN_57 (GPIO2) for UART0 UART0_RX
//
MAP_PinTypeUART(PIN_57, PIN_MODE_3);
+
+ //
+ // Configure PIN_01 for I2C0 I2C_SCL
+ //
+ MAP_PinTypeI2C(PIN_01, PIN_MODE_1);
+
+ //
+ // Configure PIN_02 for I2C0 I2C_SDA
+ //
+ MAP_PinTypeI2C(PIN_02, PIN_MODE_1);
}
When I add that, then I get this on the UART:
Welcome to CC3200 temperature sensor version 1.0
get_register_value 254
get_register_value 255
Temperature sensor initialized...
get_register_value 0
get_register_value 1
HardFault
R0 00000000
R1 40efd8c0
R2 00000000
R3 40efd8c0
R12 00000002
LR 2000f71d
PC 20007258
XPSR 41000000
HFSR 40000000
CFSR 00080000
The program counter of the hard fault is 0x20007258 (get_value) and the return address is 0x2000f71d (doesn't seem to make sense).
The code at 20007258 is:
20007258: ec41 0b10 vmov d0, r0, r1
That's a HW floating point operation and there is no hardware floating point unit on the cc3200. So we need to tell the toolchain to do software floating point,
wip, I'm not sure yet why we get stuck accessing the temperature sensor. build & run with
EXAMPLE=temperature ./build.sh
(or run.sh)The ffi seems to do what's expected: http://pastebin.com/VUMytsuT