Tool/software:
I'm having problems making the mlx90614 sensor give acknowledgement while using the LP-CC1312R7 launchpad with SIMPLELINK CC13XX CC26XX SDK. Two weeks trying to get ACK but the code i wrote cannot do it.
I will attach some images from the oscilloscope (comparing the waves of my error against a working arduino nano code) and my code here.
Obs.: I'm using the coap protocol to execute the functions. 1st and 2nd image are from the arduino, 3rd image is from my code.
int res_handler_MLXAmbientTemp(int8_t service_id, uint8_t source_address[static 16],
uint16_t source_port, sn_coap_hdr_s *request_ptr){
if (request_ptr->msg_code == COAP_MSG_CODE_REQUEST_GET){
uint8_t def_rt_str[70];
memset(def_rt_str, '\0', sizeof(def_rt_str));
int16_t temp;
transaction.targetAddress = OPT_ADDR; //OPT_ADDR = 0x5A Default Slave Address
transaction.readBuf = rxBuffer;
transaction.readCount = 3;
transaction.writeBuf = txBuffer;
txBuffer[0] = 0x06;
transaction.writeCount = 2;
if(I2C_transfer(i2c, &transaction))
{
temp = convertBufferToDecimal(rxBuffer);
sprintf((char*) def_rt_str, "%d rxBuffer[0] = %hhu rxBuffer[1] = %hhu", temp, rxBuffer[0], rxBuffer[1]);
coap_service_response_send(service_id, 0, request_ptr, COAP_MSG_CODE_RESPONSE_CONTENT,
COAP_CT_TEXT_PLAIN, (uint8_t*)def_rt_str, sizeof(def_rt_str));
return 1;
}else
{
uint8_t valorErro[4];
//valorErro[0] = transaction.status;
sprintf((char*) valorErro, "%d", transaction.status);
// Unsuccessful I2C transfer
//COAP_MSG_CODE_RESPONSE_INTERNAL_SERVER_ERROR
coap_service_response_send(service_id, 0, request_ptr, COAP_MSG_CODE_RESPONSE_CONTENT,
COAP_CT_TEXT_PLAIN, (uint8_t*)valorErro, sizeof(valorErro));
// sprintf((char*) def_rt_str, "%d readBuffer[0] = %hhu readBuffer[1] = %hhu", temp, readBuffer[0], readBuffer[1]);
// coap_service_response_send(service_id, 0, request_ptr, COAP_MSG_CODE_RESPONSE_CONTENT,
// COAP_CT_TEXT_PLAIN, (uint8_t*)def_rt_str, sizeof(def_rt_str));
return 0;
}
} else
{
coap_service_response_send(service_id, 0, request_ptr, COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED,
COAP_CT_TEXT_PLAIN, NULL, 0);
return 0;
}
return 0;
}