problems with T7 PWM out | LabJack
 

problems with T7 PWM out

4 posts / 0 new
Last post
Sudharsan Krishnamurthy
skrishnamurthy's picture
problems with T7 PWM out

Hello,

I have been trying to generate PWM out using T7 to control my cooling fan in an equipment. Since I'm already using clock1 to read the PWM frequency of another circuit, I wanted to use clock2 to generate PWM output which controls the fan. The output is obtained using DIO3 (FIO3).

I followed the PWM out example that came with labjack libraries. The body of my code (python3) looks like this

from labjack import ljm

handle1 = ljm.open(ljm.constants.dtANY,  ljm.constants.ctANY,  "ANY") #  ****I have problems here****

# Disable clock sources

ljm.eWriteName(handle1,"DIO_EF_CLOCK1_ENABLE", 0)

ljm.eWriteName(handle1,"DIO_EF_CLOCK2_ENABLE", 0)
ljm.eWriteName(handle1,"DIO_EF_CLOCK0_ENABLE", 0)
 


# Set Clock2's divisor and roll value to configure frequency: 80MHz/1/3200 = 25kHz
ljm.eWriteName(handle1, "DIO_EF_CLOCK2_DIVISOR", 1)
ljm.eWriteName(handle1, "DIO_EF_CLOCK2_ROLL_VALUE", 3200)

# Enable the clock2

ljm.eWriteName(handle1,"DIO_EF_CLOCK2_ENABLE", 1)

 

# Configuring the EF channel

ljm.eWriteName(handle1, "DIO3_EF_ENABLE", 0)
ljm.eWriteName(handle1, "DIO3_EF_INDEX", 0)
ljm.eWriteName(handle1, "DIO3_EF_OPTIONS", 2)
ljm.eWriteName(handle1, "DIO3_EF_CONFIG_A", 1600)  # 50% duty cycle
ljm.eWriteName(handle1, "DIO3_EF_ENABLE", 1)

ljm.eWriteName(handle1, "DIO_EF_CLOCK2_DIVISOR", 1)
ljm.eWriteName(handle1, "DIO_EF_CLOCK2_ROLL_VALUE", 3200)

 

# Play with the duty cycle

ljm.eWriteName(handle1, "DIO3_EF_CONFIG_A", 800)

ljm.close(handle1)

 

Everything works fine if I control the T7 with just USB. I'm not using kipling. I'm just connecting the USB to my T7 and opening the handle with Python. This works great and delivers the functionality.

However, problem arises when I try to use RJ45 ethernet interface. I power up the T7 using the power adapter and use RJ45 cable to communicate with my T7. To achieve this, I change my code only at one instance,

 

handle1 = ljm.open(ljm.constants.dtANY,  ljm.constants.ctANY,  "192.168.4.201") #  ****Give the IP****

 

I just change the parameter to open my handle. I supply the IP address of my T7 (my ethernet adapter is in the same subnet). The handle gets opened. I'm able to read the device info. Everything else in my code remains unchanged. However, I'm not able to get PWM out from DIO3.  

It's something strange that the same T7 which was working fine with USB, doesn't seem work with ethernet connection. Is there anything that I'm missing here? Thanks in advance

LabJack Support
labjack support's picture
The PWM feature should work

The PWM feature should work independent of connection type. Do you see any errors when you try to run via Ethernet?

Please try upgrading your firmware to either 1.0292 (release) or 1.0305 (beta). This can be done in the device updater tab of Kipling.

I would recommend testing in Kipling via an Ethernet connection. You could go to the dashboard and toggle DIO3 manually to ensure you see that working, then try to configure the feature using the register matrix.

Sudharsan Krishnamurthy
skrishnamurthy's picture
I kind of solved the problem.

I kind of solved the problem. But I'm not sure what caused this. 

 

The cooling fan has 4 wires. +5V,  -5V, PWM, and tacho. While I was connecting the labjack through USB, it was just the PWM cable that was connected from the fan. I presume the PWM was generated using GND as a reference.

Since during USB connection, it has a GND wire in it, the set-up worked as it should. But while connecting through ethernet, GND was missing (the power adapter doesn't have an earthing wire)

I tried to pull the -5V on my fan and connected it to the GND terminal on Labjack. and it solved my issue. 

LabJack Support
labjack support's picture
We would recommend you

We would recommend you connect LabJack GND to the fan regardless of your communication method, that is the only way to ensure you always have a good path back to LabJack GND. Without any good path to LabJack GND your fan sees an open circuit, hence your PWM issue.