IrThermo 3.3V and USB Click Adapter

General discussion on mikroElektronika development boards.
Post Reply
Author
Message
nixte
Posts: 2
Joined: 26 Jan 2015 22:29

IrThermo 3.3V and USB Click Adapter

#1 Post by nixte » 26 Jan 2015 22:33

Hi,

I have IrThermo 3.3V board and USB Click Adapter, and I don't know how to read sensor from my computer. Is it posible to do that using some terminal software (like RealTerm)?

User avatar
nemanja.nikolic
Posts: 171
Joined: 01 Dec 2014 10:50

Re: IrThermo 3.3V and USB Click Adapter

#2 Post by nemanja.nikolic » 27 Jan 2015 10:31

Hello,

For that you need to write your own application. It isn't easy.

Nemanja.

Best regards.

nixte
Posts: 2
Joined: 26 Jan 2015 22:29

Re: IrThermo 3.3V and USB Click Adapter

#3 Post by nixte » 27 Jan 2015 22:15

Thank you for your answer!
I have IrThermo board and STM32VLDISCOVERY board and I must program it in IAR, I have problem with SMBUS communication.

This is code that get stuck at last while loop and never pass it. Does some one know what can be a problem?

Code: Select all

  uint8_t I2C_address;
  uint32_t I2C_speed;
  
  GPIO_InitTypeDef    GPIO_InitStructure;
  I2C_InitTypeDef     I2C_InitStructure;
  
  I2C_address = 0x5A<<1; //
  //address = 0x94;   //
  I2C_speed = 100000;   // 1000Hz
  
  /*enable I2C*/
  //I2C_Cmd(I2C1,ENABLE);
  
  /* I2C1 clock enable */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
  
  /* I2C1 SDA and SCL configuration */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
  GPIO_Init(GPIOB, &GPIO_InitStructure);
  //SCL is pin06 and SDA is pin 07 for I2C1
  
  /* I2C1 configuration */
  I2C_InitStructure.I2C_Mode = I2C_Mode_SMBusHost;
  I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
  I2C_InitStructure.I2C_OwnAddress1 = 0x01;
  I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
  I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
  I2C_InitStructure.I2C_ClockSpeed = I2C_speed ;
  I2C_Init(I2C1, &I2C_InitStructure);
  
  I2C_Cmd(I2C1,ENABLE);
  
  I2C_AcknowledgeConfig(I2C1, ENABLE);
  /* Test on BUSY Flag */
  while (I2C_GetFlagStatus(I2C1,I2C_FLAG_BUSY));
  /* Enable the I2C peripheral */
  /*======================================================*/
  I2C_GenerateSTART(I2C1, ENABLE);
  /* Test on start flag */
  while (!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_MODE_SELECT));
  /* Send device address for write */
  I2C_Send7bitAddress(I2C1, I2C_address, I2C_Direction_Transmitter);
  /* Test on master Flag */
  while (!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
...

wildseyed
Posts: 1
Joined: 27 Jan 2015 07:06

Re: IrThermo 3.3V and USB Click Adapter

#4 Post by wildseyed » 28 Jan 2015 02:30

That's not really an answer, is it?

I have just a little experience with click boards at this point, and none with the two boards you just mentioned, but perhaps I can shed some light, and at least help you set realistic expectations and goals.

There is |THIS| much support (line up your fingers with the bars :) for the click boards on line. What support there is exists in the form of code examples for PIC, ARM, and sometimes ATMEGA micros. The examples are targeted at the MikroE dev boards, which makes sense, I guess. There is also a corresponding PDF document, usually two pages, that gives the most basic information about the click board.

The first bits of information you need are there.

1. Which signals are used/supported for operating the board. SPI, I2C, PWM, UART, and so on.

2. A link to the various data sheets for the main components on the board. You need to follow these links in order to learn how to talk to the devices, because even when the code examples demonstrate communications, they don't really get into much detail about why a certain bit of code is the way it is. Data sheets are not always easy to read, but they really do have everything you need as far as information about the device goes.

3. A diagram of how to hook up the device.

Now, in your specific application, you want to:
1. Monitor a temperature from the IrThermo click
2. Communicate this information in some human readable form to the PC, connected via USB Click.
3. Display the information in a terminal program, like RealTerm, or better yet, PuTTY.

Step 1 - Acquire Temperature data
This board support two communication modes: I2C, and PWM. The default is I2C. Changing to PWM requires desoldering the two ZERO Ohm resistors, and moving them from the I2C position to the PWM position on the board. My opinion is that PWM is the easier way to go, so if you don't need anything fancy, move the jumpers over to PWM, and have a look at the code examples for that method.

Step 2 - Send Data over USB to PC
Since you have the USB click, and not USB UART CLICK, you need to set J1 to the correct position for serial communication. J1 jumper is used to select whether UART or I2C will be used. You will want to use UART, since this is what the terminal wants to see.

Now you will need to search the code examples, and see how the UART is configured for use, and how data is sent.

Step 3 - Display data in terminal program
This part is easy. Find out what serial port your USB click has been assigned, make sure baud rate and other settings match, and connect with your favorite terminal program.

I know this is not the solution you were looking for, but it is the solution needed. Good luck!

Post Reply

Return to “Development Boards”