I'm running the following simple code (comming from example) on PICMZ32 Clicker with RN4678 Click
The RN4678 as a master bluetooth send 1 byte per second.
I'm connected with the bluetooth module on my smartphone with bluetooth terminal app,
I'm recieving wrong value (Only ZERO) but 1 byte each second as expected.
What am I doing wrong.
When I'm using rn4678_send() , I also recieve only 0..
regards.
Code: Select all
uint8_t MESSAGE_DATA[ 9 ] = { 'M', 'i', 'k', 'r', 'o', 'E', 13, 10, 0 };
uint8_t RN4678_ADDR_MASTER[ 13 ] = {'0', '4', '9', '1', '6', '2', 'A', '3', '6', '8', '2', 'F','0'};
uint8_t RN4678_ADDR_SLAVE1[ 13 ] = {'F', '4', '7', 'D', 'E', 'F', '0', '8', '8', '5', '9', '2','0'};
void systemInit()
{
ANSELB = 0; // Analog selector
TRISB.B9 = 0; // Initialize PORTB as output
LATB = 0; // Set PORTB to zero
LATB.B9 = 1;
mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_INT_PIN, _GPIO_INPUT );
mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT );
mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_CS_PIN, _GPIO_OUTPUT );
mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_PWM_PIN, _GPIO_OUTPUT );
mikrobus_uartInit( _MIKROBUS1, &_RN4678_UART_CFG[0] );
Delay_ms( 100 );
}
void applicationInit()
{
rn4678_uartDriverInit( (T_RN4678_P)&_MIKROBUS1_GPIO, (T_RN4678_P)&_MIKROBUS1_UART );
Delay_ms( 100 );
rn4678_initialize( &RN4678_ADDR_MASTER[ 0 ] );
Delay_ms( 100 );
rn4678_clearMsg();
Delay_ms( 100 );
rn4678_connect( &RN4678_ADDR_SLAVE1[ 0 ] );
}
void applicationTask()
{
// rn4678_send( _RN4678_MTYPE_MSG, _RN4678_DTYPE_STRING, _RN4678_ID_SLAVE, &MESSAGE_DATA[ 0 ] );
rn4678_writeByte(0xFF);
}
void main()
{
systemInit();
applicationInit();
while (1)
{
LATB.B9 = ~PORTB.B9; // Led Blinking
Delay_ms(1000);
applicationTask();
}
rn4678_disconnect();
}