Content originally posted in LPCWare by vthinsel on Fri Mar 04 03:36:47 MST 2011
It was this, indeed. Console happily says:
[FONT=Courier New]DS1631 initialized at address 0x48[/FONT] :)
Now I'm progressing and try to read from the DS6131, unfortunately, I end up in:
[FONT=Courier New]void HardFault_Handler(void)
{
while(1)
{
}
}[/FONT]
Context:
[FONT=Courier New]unsigned char ds1631GetConfig(uint8_t i2cAddr,uint8_t *cfg)
{
uint8_t* buffer_tx;
uint8_t* buffer_rx;
// write the ds1631 configuration byte
buffer_tx[0] = DS1631_CMD_ACCESSCONFIG;
I2C_M_SETUP_Type rxsetup;
rxsetup.sl_addr7bit = i2cAddr;
rxsetup.tx_data = buffer_tx; // Get address to read at writing address
rxsetup.tx_length = 1;
rxsetup.rx_data = buffer_rx;
rxsetup.rx_length = 1;
rxsetup.retransmissions_max = 3;
I2C_MasterTransferData(I2CDEV, &rxsetup, I2C_TRANSFER_POLLING);
*cfg = (int8_t)buffer_rx[0];
return SUCCESS;
}
[/FONT]
When debugging, the vars are as follow:
[FONT=Courier New]i2cAddr 'H'
cfg 0x10007f8f
*cfg 0
buffer_tx 0x00000000
*buffer_tx 0
buffer_rx 0x000000c8
*buffer_rx 'A'
rxsetup {...}
sl_addr7bit 0
tx_data 0x2007c000
tx_length 268468056
tx_count 32663
rx_data 0x00000001
rx_length 32644
rx_count 1073758208
retransmissions_max 0
retransmissions_count 1073758208
status 268468088
callback 0x00002da9 [/FONT]
And I'm sent in the handler when running [FONT=Courier New]rxsetup.sl_addr7bit = i2cAddr;
[FONT=Arial]What have I missed this time ? I'm surprised by [/FONT][/FONT][FONT=Courier New]buffer_tx 0x00000000 [/FONT][FONT=Courier New]
Thanks.
[/FONT]