PIC32MX Click 2 and MagicRFID

mikroC, mikroBasic and mikroPascal PRO for Microchip’s 32-bit PIC MCUs
Post Reply
Author
Message
jperez
Posts: 10
Joined: 24 Feb 2023 10:48

PIC32MX Click 2 and MagicRFID

#1 Post by jperez » 29 Aug 2023 16:55

Hello,

I have a Magic RFID on bus1 and a USB uart on bus 2. Downloaded all packages (Pic32mx click board, magic and usb uart) for MicroC Pro and still cannot get it to work.

Code: Select all

void system_init ( )
{
    mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_CS_PIN, _GPIO_OUTPUT );
    mikrobus_uartInit( _MIKROBUS1, &MAGICRFID_UART_CFG[0] );
    mikrobus_logInit( _MIKROBUS2, 115200 ); <-------------------------------------------------------------is this correct?
    mikrobus_logWrite( "--- System Init --- ", _LOG_LINE );
    Delay_ms( 100 );
}

void application_init ( )
{
    magicrfid_uart_driver_init
    ( 
        (magicrfid_obj_t)&_MIKROBUS1_GPIO, 
        (magicrfid_obj_t)&_MIKROBUS1_UART 
    );
    
    magicrfid_device_reset( );
    mikrobus_logWrite( " >> Please, wait for device setup.", _LOG_LINE ); <-------------------------------------------------------I am getting this message over and over again.  It is crashing at magicrfid_default_setup()
    magicrfid_default_setup( );
    Delay_ms( 1000 );
    mikrobus_logWrite( " >> Initialization done, reading tag is available.", _LOG_LINE );
    magicrfid_init_uart_isr( );
}


User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: PIC32MX Click 2 and MagicRFID

#2 Post by IvanJeremic » 31 Aug 2023 08:45

Hi,

What you wrote looks fine, can you tell me what happens when you run the code?

If you do not get anything on the Uart terminal it could be due to the clock scheme not being set correctly.

Regards,

Ivan.

jperez
Posts: 10
Joined: 24 Feb 2023 10:48

Re: PIC32MX Click 2 and MagicRFID

#3 Post by jperez » 31 Aug 2023 14:44

I got it working in Necto but since Necto does not allow me to hardware debug for some reason, I have to use mikroC PRO. The necto API is more complete, has functions to change region which was my problem. I was getting garbage on the UART. Ill see if I can massage the header file from necto into MikroC PRO.

Post Reply

Return to “PIC32 PRO Compilers”