An electronic circuit (100; 300; 400; 500), comprising: a semiconductor substrate having a surface; an epitaxial layer disposed over the surface of the semiconductor substrate, the epitaxial layer having a first surface distal from the semiconductor substrate and a second surface proximate to the semiconductor substrate; a planar Hall effect element (118; 324), at least a portion of the planar Hall effect element disposed in the epitaxial layer; and a current generator (102; 406) configured to generate a drive current (116a; 406a; 510a) that passes through the planar Hall effect element, wherein the current generator comprises: a first resistor (110; 200; 302; 408; 502) for receiving a reference voltage resulting in a reference current (108a; 408a) passing through the first resistor, the reference current related to the drive current, the first resistor disposed in the epitaxial layer, wherein a resistance of the first resistor, the reference current, and the drive current change in accordance with changes of a stress in the semiconductor substrate, wherein the first resistor comprises: first and second pickups (208, 210; 306, 308) implanted upon and diffused into the first surface of the epitaxial layer; and a first buried structure (204; 304) disposed under the first surface of the epitaxial layer and under the first and second pickups, wherein the first buried structure has a density of atoms that results in a first low resistance path with a first resistance lower than a resistance of the epitaxial layer, wherein the reference current passes from the first pickup, through a first region of the epitaxial layer, through the first buried structure, and through a second region of the epitaxial layer to the second pickup. a semiconductor substrate having a surface; an epitaxial layer disposed over the surface of the semiconductor substrate, the epitaxial layer having a first surface distal from the semiconductor substrate and a second surface proximate to the semiconductor substrate; a planar Hall effect element (118; 324), at least a portion of the planar Hall effect element disposed in the epitaxial layer; and a current generator (102; 406) configured to generate a drive current (116a; 406a; 510a) that passes through the planar Hall effect element, wherein the current generator comprises: a first resistor (110; 200; 302; 408; 502) for receiving a reference voltage resulting in a reference current (108a; 408a) passing through the first resistor, the reference current related to the drive current, the first resistor disposed in the epitaxial layer, wherein a resistance of the first resistor, the reference current, and the drive current change in accordance with changes of a stress in the semiconductor substrate, wherein the first resistor comprises: first and second pickups (208, 210; 306, 308) implanted upon and diffused into the first surface of the epitaxial layer; and a first buried structure (204; 304) disposed under the first surface of the epitaxial layer and under the first and second pickups, wherein the first buried structure has a density of atoms that results in a first low resistance path with a first resistance lower than a resistance of the epitaxial layer, wherein the reference current passes from the first pickup, through a first region of the epitaxial layer, through the first buried structure, and through a second region of the epitaxial layer to the second pickup. a first resistor (110; 200; 302; 408; 502) for receiving a reference voltage resulting in a reference current (108a; 408a) passing through the first resistor, the reference current related to the drive current, the first resistor disposed in the epitaxial layer, wherein a resistance of the first resistor, the reference current, and the drive current change in accordance with changes of a stress in the semiconductor substrate, wherein the first resistor comprises: first and second pickups (208, 210; 306, 308) implanted upon and diffused into the first surface of the epitaxial layer; and a first buried structure (204; 304) disposed under the first surface of the epitaxial layer and under the first and second pickups, wherein the first buried structure has a density of atoms that results in a first low resistance path with a first resistance lower than a resistance of the epitaxial layer, wherein the reference current passes from the first pickup, through a first region of the epitaxial layer, through the first buried structure, and through a second region of the epitaxial layer to the second pickup. first and second pickups (208, 210; 306, 308) implanted upon and diffused into the first surface of the epitaxial layer; and a first buried structure (204; 304) disposed under the first surface of the epitaxial layer and under the first and second pickups, wherein the first buried structure has a density of atoms that results in a first low resistance path with a first resistance lower than a resistance of the epitaxial layer, wherein the reference current passes from the first pickup, through a first region of the epitaxial layer, through the first buried structure, and through a second region of the epitaxial layer to the second pickup.